Skip to content

Commit a5cc8a2

Browse files
authored
Merge pull request #572 from GJRTimmer/update/docs
Update/docs
2 parents 694900d + 72ddc06 commit a5cc8a2

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
*.exe
33
*.dll
44
*.o
5+
6+
# VSCode
7+
.vscode

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Supported Golang version:
1919

2020
- [Installation](#installation)
2121
- [API Reference](#api-reference)
22+
- [Connection String](#connection-string)
2223
- [Features](#features)
2324
- [Compilation](#compilation)
2425
- [Android](#android)
2526
- [ARM](#arm)
2627
- [Cross Compile](#cross-compile)
27-
- [Docker](#docker)
28-
- [Alpine](#alpine)
2928
- [Google Cloud Platform](#google-cloud-platform)
3029
- [Linux](#linux)
30+
- [Alpine](#alpine)
3131
- [Fedora](#fedora)
3232
- [Ubuntu](#ubuntu)
3333
- [Mac OSX](#mac-osx)
@@ -54,6 +54,36 @@ API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite
5454

5555
Examples can be found under the [examples](./_example) directory
5656

57+
# Connection String
58+
59+
When creating a new SQLite database or connection to an existing one, with the file name additional options can be given.
60+
This is also known as a DSN string. (Data Source Name).
61+
62+
Options are append after the filename of the SQLite database.
63+
The database filename and options are seperated by an `?` (Question Mark).
64+
65+
This also applies when using an in-memory database instead of a file.
66+
67+
Options can be given using the following format: `KEYWORD=VALUE` and multiple options can be combined with the `&` ampersand.
68+
69+
This library supports dsn options of SQLite itself and provides additional options.
70+
71+
| Name | Key | Value(s) | Description |
72+
|------|-----|----------|-------------|
73+
| Shared-Cache Mode | cache | <ul><li>shared</li><li>private</li></ul> | Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) |
74+
| Time Zone Location | _loc | auto | Specify location of time format. |
75+
| Busy Timeout | _busy_timeout | `int` | Specify value for sqlite3_busy_timeout. |
76+
| Transaction Lock | _txlock | <ul><li>immediate</li><li>deferred</li><li>exclusive</li></ul> | Specify locking behavior for transactions. |
77+
| Foreign Keys | _foreign_keys | <ul><li>0</li><li>1</li></ul> | Enable or disable enforcement of foreign keys. |
78+
| Recursive Triggers | _recursive_triggers | <ul><li>0</li><li>1</li></ul> | Enable or disable recursive triggers. |
79+
| Mutex Locking | _mutex | <ul><li>no</li><li>full</li></ul> | Specify mutex mode. |
80+
81+
## DSN Examples
82+
83+
```
84+
file:test.db?cache=shared&mode=memory
85+
```
86+
5787
# Features
5888

5989
This package allows additional configuration of features available within SQLite3 to be enabled or disabled by golang build constraints also known as build `tags`.

0 commit comments

Comments
 (0)