@@ -8,17 +8,25 @@ Go module `github.com/ncruces/go-sqlite3` wraps a [WASM](https://webassembly.org
8
8
and uses [ wazero] ( https://wazero.io/ ) to provide ` cgo ` -free SQLite bindings.
9
9
10
10
- Package [ ` github.com/ncruces/go-sqlite3 ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3 )
11
- wraps the [ C SQLite API] ( https://www.sqlite.org/cintro.html )
12
- ([ example usage] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3#example-package ) ).
11
+ wraps the [ C SQLite API] ( https://www.sqlite.org/cintro.html )
12
+ ([ example usage] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3#example-package ) ).
13
13
- Package [ ` github.com/ncruces/go-sqlite3/driver ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/driver )
14
- provides a [ ` database/sql ` ] ( https://pkg.go.dev/database/sql ) driver
15
- ([ example usage] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/driver#example-package ) ).
14
+ provides a [ ` database/sql ` ] ( https://pkg.go.dev/database/sql ) driver
15
+ ([ example usage] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/driver#example-package ) ).
16
16
- Package [ ` github.com/ncruces/go-sqlite3/embed ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/embed )
17
- embeds a build of SQLite into your application.
17
+ embeds a build of SQLite into your application.
18
18
- Package [ ` github.com/ncruces/go-sqlite3/vfs ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs )
19
- wraps the [ C SQLite VFS API] ( https://www.sqlite.org/vfs.html ) and provides a pure Go implementation.
19
+ wraps the [ C SQLite VFS API] ( https://www.sqlite.org/vfs.html ) and provides a pure Go implementation.
20
+ - Package [ ` github.com/ncruces/go-sqlite3/vfs/memdb ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/memdb )
21
+ implements an in-memory VFS.
22
+ - Package [ ` github.com/ncruces/go-sqlite3/vfs/readervfs ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/readervfs )
23
+ implements a VFS for immutable databases.
24
+ - Package [ ` github.com/ncruces/go-sqlite3/ext/unicode ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/unicode )
25
+ registers Unicode aware functions.
26
+ - Package [ ` github.com/ncruces/go-sqlite3/ext/stats ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/stats )
27
+ registers [ statistics functions] ( https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s02.html ) .
20
28
- Package [ ` github.com/ncruces/go-sqlite3/gormlite ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/gormlite )
21
- provides a [ GORM] ( https://gorm.io ) driver.
29
+ provides a [ GORM] ( https://gorm.io ) driver.
22
30
23
31
### Caveats
24
32
@@ -35,7 +43,8 @@ To work around this limitation, SQLite is [patched](sqlite3/locking_mode.patch)
35
43
to always use ` EXCLUSIVE ` locking mode for WAL databases.
36
44
37
45
Because connection pooling is incompatible with ` EXCLUSIVE ` locking mode,
38
- to open WAL databases you should disable connection pooling by calling
46
+ to use the [ ` database/sql ` ] ( https://pkg.go.dev/database/sql )
47
+ driver with WAL databases you should disable connection pooling by calling
39
48
[ ` db.SetMaxOpenConns(1) ` ] ( https://pkg.go.dev/database/sql#DB.SetMaxOpenConns ) .
40
49
41
50
#### POSIX Advisory Locks
@@ -53,6 +62,18 @@ On BSD Unixes, this module uses
53
62
BSD locks may _ not_ be compatible with process-associated POSIX advisory locks
54
63
(they are on FreeBSD).
55
64
65
+ ##### TL;DR
66
+
67
+ In all platforms for which this package builds,
68
+ it is safe to use it to access databases concurrently from multiple goroutines.
69
+
70
+ Additionally, on Windows, Linux, macOS, illumos and FreeBSD,
71
+ it is _ also_ safe to use it to access databases concurrently
72
+ with _ other_ implementations of SQLite.
73
+
74
+ On other BSDs, where this might be unsafe,
75
+ [ this test] ( https://github.com/ncruces/go-sqlite3/blob/main/vfs/lock_test.go ) should fail.
76
+
56
77
#### Testing
57
78
58
79
The pure Go VFS is tested by running SQLite's
@@ -82,4 +103,4 @@ Performance is tested by running
82
103
- [ ` modernc.org/sqlite ` ] ( https://pkg.go.dev/modernc.org/sqlite )
83
104
- [ ` crawshaw.io/sqlite ` ] ( https://pkg.go.dev/crawshaw.io/sqlite )
84
105
- [ ` github.com/mattn/go-sqlite3 ` ] ( https://pkg.go.dev/github.com/mattn/go-sqlite3 )
85
- - [ ` github.com/zombiezen/go-sqlite ` ] ( https://pkg.go.dev/github.com/zombiezen/go-sqlite )
106
+ - [ ` github.com/zombiezen/go-sqlite ` ] ( https://pkg.go.dev/github.com/zombiezen/go-sqlite )
0 commit comments