Skip to content

Commit 2434eb5

Browse files
committed
Updated documentation
1 parent 8eb68fb commit 2434eb5

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

pkg/sqlite3/README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ copy of __sqlite__ as part of the build process, but expect a `pkgconfig`
1414
file called `sqlite3.pc` to be present (and an existing set of header
1515
files and libraries to be available to link against, of course).
1616

17-
In order to locate the __pkgconfig__ file in a non-standard location, use
18-
two environment variables:
17+
In order to locate the correct installation of `sqlite3` use two environment variables:
1918

2019
* `PKG_CONFIG_PATH` is used for locating `sqlite3.pc`
2120
* `DYLD_LIBRARY_PATH` is used for locating the dynamic library when testing and/or running
2221

23-
On Macintosh with homebrew:
24-
sqlite using `` and this is how I run the tests:
22+
On Macintosh with homebrew, for example:
2523

2624
```bash
2725
[bash] brew install sqlite3
@@ -32,8 +30,18 @@ sqlite using `` and this is how I run the tests:
3230
[bash] PKG_CONFIG_PATH="${SQLITE_LIB}/pkgconfig" DYLD_LIBRARY_PATH="${SQLITE_LIB}" go test -v ./pkg/sqlite3
3331
```
3432

33+
On Debian Linux you shouldn't need to locate the correct path to the sqlite3 library:
34+
35+
```bash
36+
[bash] sudo apt install libsqlite3-dev
37+
[bash] git clone git@github.com:djthorpe/go-sqlite.git
38+
[bash] cd go-sqlite
39+
[bash] go mod tidy
40+
[bash] go test -v ./pkg/sqlite3
41+
```
42+
3543
There are some examples in the `cmd` folder of the main repository on how to use
36-
the bindings, and various pseudo examples in this document.
44+
the package, and various pseudo examples in this document.
3745

3846
## Contributing & Distribution
3947

@@ -48,10 +56,10 @@ repository for more information:
4856

4957
The package includes:
5058

51-
* __Connection Pool__ for managing connections to sqlite3 databases;
52-
* __Connection__ for executing queries;
53-
* __Auth__ interface for managing authentication and authorization;
54-
* and a __Cache__ for managing prepared statements and profiling for slow
59+
* A Connection __Pool__ for managing connections to sqlite3 databases;
60+
* A __Connection__ for executing queries;
61+
* An __Auth__ interface for managing authentication and authorization;
62+
* A __Cache__ for managing prepared statements and profiling for slow
5563
queries.
5664

5765
It's possible to create custom functions (both in a scalar and aggregate context)
@@ -74,14 +82,20 @@ func main() {
7482
}
7583
defer pool.Close()
7684

85+
// Onbtain a connection from pool, put back when done
86+
conn := pool.Get(context.Background())
87+
defer pool.Put(conn)
88+
7789
// Enumerate the tables in the database
78-
tables := pool.Get(context.Background()).Tables()
90+
tables := conn.Tables()
91+
7992
// ...
8093
}
8194
```
8295

8396
In this example, a database is opened and the `Get` method obtains a connection
84-
to the database. The `Tables` method enumerates the tables in the database.
97+
to the databaseand `Put` will return it to the pool. The `Tables` method enumerates
98+
the tables in the database.
8599

86100
## Connection Pool
87101

0 commit comments

Comments
 (0)