Update README.md

This commit is contained in:
Nuno Cruces
2023-01-26 01:11:09 +00:00
parent d88a19f7e8
commit 17b720a217
5 changed files with 24 additions and 24 deletions

15
.github/coverage.sh vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail
cd -P -- "$(dirname -- "$0")"
go test ../... -coverprofile coverage.svg
COVERAGE=$(go tool cover -func=coverage.svg | grep total: | grep -Eo '[0-9]+\.[0-9]+')
echo $COVERAGE
COLOR=orange
if (( $(echo "$COVERAGE <= 50" | bc -l) )) ; then
COLOR=red
elif (( $(echo "$COVERAGE > 80" | bc -l) )); then
COLOR=green
fi
curl -s "https://img.shields.io/badge/coverage-$COVERAGE%25-$COLOR" > coverage.svg

1
.github/coverage.svg vendored Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 50.6%"><title>coverage: 50.6%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">50.6%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">50.6%</text></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,8 +1,13 @@
# Go bindings to SQLite using Wazero
⚠️ DO NOT USE with data you care about. ⚠️
[![Go Reference](https://pkg.go.dev/badge/image)](https://pkg.go.dev/github.com/ncruces/go-sqlite3)
[![Go Report](https://goreportcard.com/badge/github.com/ncruces/go-sqlite3)](https://goreportcard.com/report/github.com/ncruces/go-sqlite3)
![Go Coverage](.github/coverage.svg)
This is very much a WIP.
⚠️ CAUTION ⚠️
This is still very much a WIP.\
DO NOT USE this with data you care about.
Roadmap:
- [x] build SQLite using `zig cc --target=wasm32-wasi`
@@ -11,21 +16,4 @@ Roadmap:
- branch [`wasi`](https://github.com/ncruces/go-sqlite3/tree/wasi) uses `test_demovfs.c` directly
- [x] come up with a simple, nice API, enough for simple queries
- [ ] file locking, compatible with SQLite on Windows/Unix
- [ ] ~shared-memory, compatible with SQLite on Windows/Unix~
Benchmarks:
```
goos: darwin
goarch: amd64
pkg: github.com/ncruces/go-sqlite3/bench
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkCrawshaw-12 8 677059222 ns/op 104003008 B/op 9000000 allocs/op
BenchmarkWasm-12 8 702393992 ns/op 178750252 B/op 11000110 allocs/op
BenchmarkWASI-12 5 1015034369 ns/op 178750009 B/op 11000102 allocs/op
BenchmarkCrawshawFile-12 8 704186415 ns/op 104002593 B/op 8999998 allocs/op
BenchmarkWasmFile-12 5 1029067495 ns/op 178750070 B/op 11000102 allocs/op
BenchmarkWASIFile-12 3 2226217997 ns/op 868255072 B/op 16000200 allocs/op
```
- [ ] ~shared-memory, compatible with SQLite on Windows/Unix~

1
go.mod
View File

@@ -3,7 +3,6 @@ module github.com/ncruces/go-sqlite3
go 1.19
require (
crawshaw.io/sqlite v0.3.2
github.com/ncruces/julianday v0.1.3
github.com/tetratelabs/wazero v1.0.0-pre.7.0.20230117161130-15889085a5ca
)

3
go.sum
View File

@@ -1,6 +1,3 @@
crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk=
crawshaw.io/sqlite v0.3.2 h1:N6IzTjkiw9FItHAa0jp+ZKC6tuLzXqAYIv+ccIWos1I=
crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
github.com/ncruces/julianday v0.1.3 h1:+JRqsbdGH8QlPWlB6i/pD8sENBZZ1qg24qBCAcYfGMU=
github.com/ncruces/julianday v0.1.3/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
github.com/tetratelabs/wazero v1.0.0-pre.7.0.20230117161130-15889085a5ca h1:cvbRnzLE99QnA6HT3yoqXjWEB2JMiyTs3GSLpQZg45A=