sqlite3 driver for go that using database/sql
C Objective-C Go Other
Latest commit 7ed900a Jan 18, 2017 @mattn fix test
Failed to load latest commit information.
_example dummy constants Jan 10, 2017
sqlite3_test Merge branch 'pr/207' Nov 2, 2015
tool fix tree for tools/upgrade.go Dec 9, 2016
.gitignore add *.o Aug 11, 2016
.travis.yml disable combination of libsqlite3 and trace because travis(trusty) is… Nov 8, 2016
LICENSE Add LICENSE file Aug 18, 2014
README.md FAQ about concurrency. Close #350 Nov 7, 2016
backup.go go vet && golint Nov 4, 2016
backup_test.go Test the error reporting when preparing to perform a backup. Sep 23, 2016
callback.go fix trace callback. Nov 8, 2016
callback_test.go Move argument converters to callback.go, and optimize return value ha… Aug 21, 2015
doc.go Removing an unused C import to allow for "buildable" go files. Fixes #… Jan 18, 2017
error.go go vet && golint Nov 4, 2016
error_test.go Add test for ErrNo.Extend() Jan 26, 2015
sqlite3-binding.c upgrade amalgamation code Nov 11, 2016
sqlite3-binding.h upgrade amalgamation code Nov 11, 2016
sqlite3.go close statement Jan 7, 2017
sqlite3_fts3_test.go FTS4 is not available on Trusty Apr 22, 2016
sqlite3_fts5.go Conditional build for the FTS5 Extension Mar 7, 2016
sqlite3_go18.go temporary fix BeginTx Dec 15, 2016
sqlite3_go18_test.go fix tests Dec 9, 2016
sqlite3_icu.go remove trailing space Nov 4, 2016
sqlite3_json1.go Conditional build for the JSON1 Extension Feb 28, 2016
sqlite3_libsqlite3.go Disable LoadExtension when omit_load_extension is specified Apr 18, 2016
sqlite3_load_extension.go go vet && golint Nov 4, 2016
sqlite3_omit_load_extension.go Disable LoadExtension when omit_load_extension is specified Apr 18, 2016
sqlite3_other.go remove -lpthread. related issue #201 Apr 27, 2015
sqlite3_test.go fix test Jan 18, 2017
sqlite3_trace_test.go fix test Jan 18, 2017
sqlite3_type.go go vet && golint Nov 6, 2016
sqlite3_windows.go Fix compile for old mingw32 Dec 29, 2015
sqlite3ext.h upgrade amalgamation code Nov 11, 2016
tracecallback.go fix test Jan 18, 2017



Build Status Coverage Status GoDoc


sqlite3 driver conforming to the built-in database/sql interface


This package can be installed with the go get command:

go get github.com/mattn/go-sqlite3

go-sqlite3 is cgo package. If you want to build your app using go-sqlite3, you need gcc. However, if you install go-sqlite3 with go install github.com/mattn/go-sqlite3, you don't need gcc to build your app anymore.


API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3

Examples can be found under the ./_example directory


  • Want to build go-sqlite3 with libsqlite3 on my linux.

    Use go build --tags "libsqlite3 linux"

  • Want to build go-sqlite3 with libsqlite3 on OS X.

    Install sqlite3 from homebrew: brew install sqlite3

    Use go build --tags "libsqlite3 darwin"

  • Want to build go-sqlite3 with icu extension.

    Use go build --tags "icu"

  • Can't build go-sqlite3 on windows 64bit.

    Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking on windows 64bit. See: https://github.com/mattn/go-sqlite3/issues/27

  • Getting insert error while query is opened.

    You can pass some arguments into the connection string, for example, a URI. See: https://github.com/mattn/go-sqlite3/issues/39

  • Do you want to cross compile? mingw on Linux or Mac?

    See: https://github.com/mattn/go-sqlite3/issues/106 See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html

  • Want to get time.Time with current locale

    Use loc=auto in SQLite3 filename schema like file:foo.db?loc=auto.

  • Can use this in multiple routines concurrently?

    Yes for readonly. But, No for writable. See #50, #51, #209.


MIT: http://mattn.mit-license.org/2012

sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h

The -binding suffix was added to avoid build failures under gccgo.

In this repository, those files are an amalgamation of code that was copied from SQLite3. The license of that code is the same as the license of SQLite3.


Yasuhiro Matsumoto (a.k.a mattn)