mattn / go-sqlite3

sqlite3 driver for go using database/sql
http://mattn.github.io/go-sqlite3
MIT License
8.05k stars 1.11k forks source link

vtable example broken #1251

Closed tionis closed 4 months ago

tionis commented 5 months ago

I'm getting the following error during compile:

# github.com/mattn/go-sqlite3/_example/vtable
./vtable.go:22:78: undefined: sqlite3.VTab
./vtable.go:23:11: c.DeclareVTab undefined (type *sqlite3.SQLiteConn has no field or method DeclareVTab)
./vtable.go:36:79: undefined: sqlite3.VTab
./vtable.go:46:39: undefined: sqlite3.VTabCursor
./vtable.go:65:48: undefined: sqlite3.InfoConstraint
./vtable.go:65:77: undefined: sqlite3.InfoOrderBy
./vtable.go:65:100: undefined: sqlite3.IndexResult
./vtable.go:67:18: undefined: sqlite3.IndexResult
./main.go:14:16: conn.CreateModule undefined (type *sqlite3.SQLiteConn has no field or method CreateModule)
ncruces commented 4 months ago

You need to build with sqlite_vtable. https://github.com/mattn/go-sqlite3/blob/3c0390b77cba9a7eaee4102e1ca6a35c14e2de7c/sqlite3_opt_vtable.go#L6

tionis commented 4 months ago

You're right! For context: The library works if the sqlite_vtable or vtable Go build tags are set. E.g. like so:

go build -tags "sqlite_vtable" .

(Or Alternatively using the GO_FLAGS env var)