{"modulePath":"github.com/authorizerdev/authorizer","version":"v0.0.0-20261127070743-7b9d768cbc3d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sql\n\n## Functions\n\n```go\nfunc IsNotFound(err error) bool\n```\nIsNotFound reports whether err means \"no such row\" in this backend. GORM already has a single canonical sentinel, so there is nothing to wrap — the bare driver error returned by First()/Take() is matched directly.\n\n```go\nfunc Models() []any\n```\nModels is the full set of tables this provider owns, in migration order. Kept in one place so alternative migrators cannot drift from AutoMigrate.\n\n## Types\n\n```go\ntype Dependencies struct {\n\tLog *zerolog.Logger\n}\n```\nDependencies struct the sql data store provider\n\n```go\ntype Options struct {\n\t// Migrate replaces GORM AutoMigrate. SereneDB rejects the\n\t// ALTER COLUMN ... TYPE that AutoMigrate re-issues on every boot, so it\n\t// supplies its own hand-written, versioned DDL instead.\n\tMigrate func(*gorm.DB) error\n\t// WrapPool wraps the connection pool before GORM sees it. SereneDB uses it\n\t// to retry write conflicts its optimistic MVCC raises. PostgreSQL family\n\t// only.\n\tWrapPool func(*stdsql.DB) gorm.ConnPool\n\t// SkipDefaultTransaction turns off the transaction GORM wraps around every\n\t// single Create/Update/Delete. Only SereneDB sets it: that implicit\n\t// transaction routes every write through BeginTx, where a conflict aborts\n\t// the whole transaction and cannot be retried statement-by-statement. The\n\t// schemas here carry no GORM associations, so one write is one statement\n\t// and the wrapper buys nothing to begin with. Explicit Transaction() blocks\n\t// are unaffected.\n\tSkipDefaultTransaction bool\n\t// RetryTransactions replays an explicit transaction from the start when it\n\t// aborts with a serialization failure (SQLSTATE 40001). Only SereneDB sets\n\t// it: its optimistic MVCC aborts contended transactions instead of making\n\t// them wait, and a statement cannot be retried inside an aborted\n\t// transaction — only the whole block can. Every other backend keeps a\n\t// single attempt, exactly as before.\n\tRetryTransactions bool\n}\n```\nOptions customise how the provider is built. They exist for engines that speak a supported wire protocol but differ underneath; all are zero for every database type this package handles directly, so the default path is unchanged.\n\n```go\ntype Provider = provider\n```\nProvider is the SQL storage provider. It is exported so wire-compatible engines that need to override a handful of methods (see internal/storage/db/serenedb) can embed it instead of duplicating the whole backend.\n\n```go\nfunc NewProvider(\n\tconfig *config.Config,\n\tdeps *Dependencies,\n) (*Provider, error)\n```\nNewProvider returns a new SQL provider\n\n```go\nfunc NewProviderWithOptions(\n\tconfig *config.Config,\n\tdeps *Dependencies,\n\topts Options,\n) (*Provider, error)\n```\nNewProviderWithOptions returns a new SQL provider with the given hooks applied. See Options.\n\n","path":"github.com/authorizerdev/authorizer/internal/storage/db/sql","name":"sql","synopsis":"","isRedistributable":true}
