Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (35 sloc) 652 Bytes
package sqlite3
// #cgo LDFLAGS: -lsqlite3
// #include <sqlite3.h>
import "C"
func Initialize() {
C.sqlite3_initialize()
}
func Shutdown() {
C.sqlite3_shutdown()
}
func Session(filename string, f func(db *Database)) {
Initialize()
defer Shutdown()
if db, e := Open(filename); e == nil {
defer db.Close()
f(db)
}
}
func TransientSession(f func(db *Database)) {
Initialize()
defer Shutdown()
if db := TransientDatabase(); db.Open() == nil {
defer db.Close()
f(db)
}
}
func LibVersion() string {
return C.GoString(C.sqlite3_libversion())
}
type Value struct {
cptr *C.sqlite3_value
}
type Blob struct {
cptr *C.sqlite3_blob
}