我对Google的Go很新,但我正在尝试通过编写一个简单的应用程序来与SQLite 3数据库进行交流.到目前为止,我遇到了一些不同的sqlite库,但它们似乎都很少维护或者很少或没有文档.
我希望有人可以通过建议一个用于SQLite 3的库,并为我提供一些简单的INSERT和SELECT的演示代码,指出我正确的方向.
感谢您的时间.
Ela*_*ich 13
编辑:也适用于Go 1.
最近每周一次,以及Linux系统上安装的Sqlite3库,你应该:
$ go get github.com/mattn/go-sqlite3
sqlite3.go: In function ‘_cgo_7e09c699097a_Cfunc_sqlite3_prepare_v2’:
sqlite3.go:198:2: warning: passing argument 5 of ‘sqlite3_prepare_v2’ from incompatible pointer type [enabled by default]
/usr/local/include/sqlite3.h:2924:16: note: expected ‘const char **’ but argument is of type ‘char **’
$ # those warnings are OK, don't worry
$ mkdir $GOPATH/src/myproject && cd $GOPATH/src/myproject
$ wget https://raw.github.com/mattn/go-sqlite3/master/example/main.go
$ vi main.go # this is an example how to use go-sqlite3
Run Code Online (Sandbox Code Playgroud)
这应该让你开始.