diff options
author | mattn <mattn.jp@gmail.com> | 2017-08-30 19:57:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-30 19:57:18 +0900 |
commit | 132eeedb4ad10f217a357d731f930cbdd1360733 (patch) | |
tree | 45438e41d445e4496b5c80066b74ba760ac07fb1 /callback.go | |
parent | Add support for collation sequences implemented in Go. (diff) | |
parent | Merge pull request #461 from mattn/solaris (diff) | |
download | golite-132eeedb4ad10f217a357d731f930cbdd1360733.tar.gz golite-132eeedb4ad10f217a357d731f930cbdd1360733.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'callback.go')
-rw-r--r-- | callback.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/callback.go b/callback.go index 244e739..29ece3d 100644 --- a/callback.go +++ b/callback.go @@ -59,6 +59,24 @@ func compareTrampoline(handlePtr uintptr, la C.int, a *C.char, lb C.int, b *C.ch return C.int(cmp(C.GoStringN(a, la), C.GoStringN(b, lb))) } +//export commitHookTrampoline +func commitHookTrampoline(handle uintptr) int { + callback := lookupHandle(handle).(func() int) + return callback() +} + +//export rollbackHookTrampoline +func rollbackHookTrampoline(handle uintptr) { + callback := lookupHandle(handle).(func()) + callback() +} + +//export updateHookTrampoline +func updateHookTrampoline(handle uintptr, op int, db *C.char, table *C.char, rowid int64) { + callback := lookupHandle(handle).(func(int, string, string, int64)) + callback(op, C.GoString(db), C.GoString(table), rowid) +} + // Use handles to avoid passing Go pointers to C. type handleVal struct { |