|  | 
| 1 |  | - # TODO Rewrite | 
|  | 1 | +# Go-SQLite3 | 
|  | 2 | + | 
|  | 3 | +[](http://godoc.org/github.com/mattn/go-sqlite3) | 
|  | 4 | +[](https://travis-ci.org/mattn/go-sqlite3) | 
|  | 5 | +[](https://coveralls.io/r/mattn/go-sqlite3?branch=master) | 
|  | 6 | +[](https://goreportcard.com/report/github.com/mattn/go-sqlite3) | 
|  | 7 | + | 
|  | 8 | +**Current Version: 2.0.0** | 
|  | 9 | + | 
|  | 10 | +**Please note that version 2.0.0 is not backwards compatible** | 
|  | 11 | + | 
|  | 12 | +## Documentation | 
|  | 13 | + | 
|  | 14 | +[More documentation is available in our Wiki](https://github.com/mattn/go-sqlite3/wiki) | 
|  | 15 | + | 
|  | 16 | +## Description | 
|  | 17 | + | 
|  | 18 | +sqlite3 driver conforming to the built-in database/sql interface | 
|  | 19 | + | 
|  | 20 | +Supported Golang version: | 
|  | 21 | +- 1.9.x | 
|  | 22 | +- 1.10.x | 
|  | 23 | + | 
|  | 24 | +[This package follows the official Golang Release Policy.](https://golang.org/doc/devel/release.html#policy) | 
|  | 25 | + | 
|  | 26 | +## Requirements | 
|  | 27 | + | 
|  | 28 | +* Go: 1.9 or higher. | 
|  | 29 | +* GCC (Go-SQLite3 is a `CGO` package) | 
|  | 30 | + | 
|  | 31 | +_go-sqlite3_ is *cgo* package. | 
|  | 32 | +If you want to build your app using go-sqlite3, you need gcc. | 
|  | 33 | +However, after you have built and installed _go-sqlite3_ with `go install github.com/mattn/go-sqlite3` (which requires gcc), you can build your app without relying on gcc in future. | 
|  | 34 | + | 
|  | 35 | +**Important: because this is a `CGO` enabled package you are required to set the environment variable `CGO_ENABLED=1` and have a `gcc` compile present within your path.** | 
|  | 36 | + | 
|  | 37 | +## Installation | 
|  | 38 | + | 
|  | 39 | +```bash | 
|  | 40 | +go get github.com/mattn/go-sqlite3/driver | 
|  | 41 | +``` | 
|  | 42 | + | 
|  | 43 | +## Usage | 
|  | 44 | + | 
|  | 45 | +`Go-SQLite3 is an implementation of Go's database/sql/driver interface. You only need to import the driver and can use the full database/sql API then. | 
|  | 46 | + | 
|  | 47 | +Use `sqlite3` as `drivername` and a valid [DSN](https://github.com/mattn/go-sqlite3/wiki/DSN) as `dataSourceName`: | 
|  | 48 | + | 
|  | 49 | +```go | 
|  | 50 | +import ( | 
|  | 51 | +    "database/sql" | 
|  | 52 | +    _ "github.com/mattn/go-sqlite3/driver" | 
|  | 53 | +) | 
|  | 54 | + | 
|  | 55 | +db, err := sql.Open("sqlite3", "file:test.db") | 
|  | 56 | +``` | 
|  | 57 | + | 
|  | 58 | +[Examples are available in our Wiki](https://github.com/mattn/go-sqlite3/wiki/Examples) | 
|  | 59 | + | 
|  | 60 | +# License | 
|  | 61 | + | 
|  | 62 | +MIT: http://mattn.mit-license.org/2018 | 
|  | 63 | + | 
|  | 64 | +sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h | 
|  | 65 | + | 
|  | 66 | +The -binding suffix was added to avoid build failures under gccgo. | 
|  | 67 | + | 
|  | 68 | +In this repository, those files are an amalgamation of code that was copied from SQLite3.  | 
|  | 69 | +The license of that code is the same as the license of SQLite3. | 
0 commit comments