From ce3d9bd4ed48cce5d8bf058b2df727318a998b81 Mon Sep 17 00:00:00 2001 From: Gert-Jan Timmer Date: Sun, 27 May 2018 16:38:22 +0200 Subject: [PATCH 1/3] Exclude vscode settings --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8a0e48d..c219728 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.exe *.dll *.o + +# VSCode +.vscode From a587d7d84f949c044a218a5fc5ca92c32620d593 Mon Sep 17 00:00:00 2001 From: Gert-Jan Timmer Date: Sun, 27 May 2018 16:38:59 +0200 Subject: [PATCH 2/3] Update TOC to match README [ci skip] --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f146c2c..d1c271c 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,9 @@ Supported Golang version: - [Android](#android) - [ARM](#arm) - [Cross Compile](#cross-compile) - - [Docker](#docker) - - [Alpine](#alpine) - [Google Cloud Platform](#google-cloud-platform) - [Linux](#linux) + - [Alpine](#alpine) - [Fedora](#fedora) - [Ubuntu](#ubuntu) - [Mac OSX](#mac-osx) From 72ddc06453e1636a9ff385f3d0091431100052b2 Mon Sep 17 00:00:00 2001 From: Gert-Jan Timmer Date: Sun, 27 May 2018 23:00:56 +0200 Subject: [PATCH 3/3] Update README Add DSN Connections string table. [ci skip] --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index d1c271c..1f51f29 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Supported Golang version: - [Installation](#installation) - [API Reference](#api-reference) +- [Connection String](#connection-string) - [Features](#features) - [Compilation](#compilation) - [Android](#android) @@ -53,6 +54,36 @@ API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite Examples can be found under the [examples](./_example) directory +# Connection String + +When creating a new SQLite database or connection to an existing one, with the file name additional options can be given. +This is also known as a DSN string. (Data Source Name). + +Options are append after the filename of the SQLite database. +The database filename and options are seperated by an `?` (Question Mark). + +This also applies when using an in-memory database instead of a file. + +Options can be given using the following format: `KEYWORD=VALUE` and multiple options can be combined with the `&` ampersand. + +This library supports dsn options of SQLite itself and provides additional options. + +| Name | Key | Value(s) | Description | +|------|-----|----------|-------------| +| Shared-Cache Mode | cache |
  • shared
  • private
| Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) | +| Time Zone Location | _loc | auto | Specify location of time format. | +| Busy Timeout | _busy_timeout | `int` | Specify value for sqlite3_busy_timeout. | +| Transaction Lock | _txlock |
  • immediate
  • deferred
  • exclusive
| Specify locking behavior for transactions. | +| Foreign Keys | _foreign_keys |
  • 0
  • 1
| Enable or disable enforcement of foreign keys. | +| Recursive Triggers | _recursive_triggers |
  • 0
  • 1
| Enable or disable recursive triggers. | +| Mutex Locking | _mutex |
  • no
  • full
| Specify mutex mode. | + +## DSN Examples + +``` +file:test.db?cache=shared&mode=memory +``` + # Features This package allows additional configuration of features available within SQLite3 to be enabled or disabled by golang build constraints also known as build `tags`.