aboutsummaryrefslogtreecommitdiff
path: root/_example/hook/hook.go
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2017-07-07 09:26:25 +0900
committerGitHub <noreply@github.com>2017-07-07 09:26:25 +0900
commit9cbb0970444f7ee9ccc65376394a504150b25de1 (patch)
tree491303da78f95a9a48126527f9f873ff4600134b /_example/hook/hook.go
parentSQLITE_THREADSAFE=1 (diff)
parentMerge pull request #2 from mattn/master (diff)
downloadgolite-9cbb0970444f7ee9ccc65376394a504150b25de1.tar.gz
golite-9cbb0970444f7ee9ccc65376394a504150b25de1.tar.xz
Merge pull request #434 from toba/master
Add functions to register update, commit, and rollback hooks (re-opened)
Diffstat (limited to '_example/hook/hook.go')
-rw-r--r--_example/hook/hook.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/_example/hook/hook.go b/_example/hook/hook.go
index 17bddeb..6023181 100644
--- a/_example/hook/hook.go
+++ b/_example/hook/hook.go
@@ -14,6 +14,12 @@ func main() {
&sqlite3.SQLiteDriver{
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
sqlite3conn = append(sqlite3conn, conn)
+ conn.RegisterUpdateHook(func(op int, db string, table string, rowid int64) {
+ switch op {
+ case sqlite3.SQLITE_INSERT:
+ log.Println("Notified of insert on db", db, "table", table, "rowid", rowid)
+ }
+ })
return nil
},
})