Fork github.com/mattn/go-sqlite3 with adjustment for go1.16.2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
599 B

  1. package main
  2. import (
  3. "database/sql"
  4. "fmt"
  5. "log"
  6. "github.com/mattn/go-sqlite3"
  7. )
  8. func main() {
  9. sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{
  10. ConnectHook: func(conn *sqlite3.SQLiteConn) error {
  11. return conn.CreateModule("series", &seriesModule{})
  12. },
  13. })
  14. db, err := sql.Open("sqlite3_with_extensions", ":memory:")
  15. if err != nil {
  16. log.Fatal(err)
  17. }
  18. defer db.Close()
  19. rows, err := db.Query("select * from series")
  20. if err != nil {
  21. log.Fatal(err)
  22. }
  23. defer rows.Close()
  24. for rows.Next() {
  25. var value int
  26. rows.Scan(&value)
  27. fmt.Printf("value: %d\n", value)
  28. }
  29. }