github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/internal/util/module.go (about) 1 package util 2 3 import ( 4 "context" 5 6 "github.com/tetratelabs/wazero/experimental" 7 ) 8 9 type moduleKey struct{} 10 type moduleState struct { 11 mmapState 12 handleState 13 } 14 15 func NewContext(ctx context.Context) context.Context { 16 state := new(moduleState) 17 ctx = withAllocator(ctx) 18 ctx = experimental.WithCloseNotifier(ctx, state) 19 ctx = context.WithValue(ctx, moduleKey{}, state) 20 return ctx 21 }