diff options
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/util/module.go')
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/util/module.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go index ba5754a32..a308b4e23 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go @@ -12,6 +12,7 @@ type ConnKey struct{} type moduleKey struct{} type moduleState struct { + sysError error mmapState handleState } @@ -23,3 +24,20 @@ func NewContext(ctx context.Context) context.Context { ctx = context.WithValue(ctx, moduleKey{}, state) return ctx } + +func GetSystemError(ctx context.Context) error { + // Test needed to simplify testing. + s, ok := ctx.Value(moduleKey{}).(*moduleState) + if ok { + return s.sysError + } + return nil +} + +func SetSystemError(ctx context.Context, err error) { + // Test needed to simplify testing. + s, ok := ctx.Value(moduleKey{}).(*moduleState) + if ok { + s.sysError = err + } +} |
