diff options
Diffstat (limited to '')
-rw-r--r-- | dependencies/pkg/mod/github.com/mattn/go-sqlite3@v1.14.16/_example/vtable_eponymous_only/main.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/dependencies/pkg/mod/github.com/mattn/go-sqlite3@v1.14.16/_example/vtable_eponymous_only/main.go b/dependencies/pkg/mod/github.com/mattn/go-sqlite3@v1.14.16/_example/vtable_eponymous_only/main.go new file mode 100644 index 0000000..17b58af --- /dev/null +++ b/dependencies/pkg/mod/github.com/mattn/go-sqlite3@v1.14.16/_example/vtable_eponymous_only/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "database/sql" + "fmt" + "log" + + "github.com/mattn/go-sqlite3" +) + +func main() { + sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{ + ConnectHook: func(conn *sqlite3.SQLiteConn) error { + return conn.CreateModule("series", &seriesModule{}) + }, + }) + db, err := sql.Open("sqlite3_with_extensions", ":memory:") + if err != nil { + log.Fatal(err) + } + defer db.Close() + + rows, err := db.Query("select * from series") + if err != nil { + log.Fatal(err) + } + defer rows.Close() + for rows.Next() { + var value int + rows.Scan(&value) + fmt.Printf("value: %d\n", value) + } +} |