aboutsummaryrefslogtreecommitdiff
path: root/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'doc.go')
-rw-r--r--doc.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/doc.go b/doc.go
index b15f782..7a4fb6d 100644
--- a/doc.go
+++ b/doc.go
@@ -79,9 +79,8 @@ Then, you can use this extension.
Connection Hook
-You can hook and inject your code when the connection is established. database/sql
-doesn't provide a way to get native go-sqlite3 interfaces. So if you want,
-you need to set ConnectHook and get the SQLiteConn.
+You can hook and inject your code when the connection is established by setting
+ConnectHook to get the SQLiteConn.
sql.Register("sqlite3_with_hook_example",
&sqlite3.SQLiteDriver{
@@ -91,6 +90,17 @@ you need to set ConnectHook and get the SQLiteConn.
},
})
+You can also use database/sql.Conn.Raw:
+
+ conn, err := db.Conn(context.Background())
+ // if err != nil { ... }
+ defer conn.Close()
+ err = conn.Raw(func (driverConn interface{}) error {
+ sqliteConn := driverConn.(*sqlite3.SQLiteConn)
+ // ... use sqliteConn
+ })
+ // if err != nil { ... }
+
Go SQlite3 Extensions
If you want to register Go functions as SQLite extension functions