Documentation ¶
Index ¶
- Variables
- func BatchValues(pkvals [][]byte, threshold int) ([][]byte, [][]byte)
- type KV
- func (d *KV) Close() error
- func (d *KV) Delete(ctx context.Context, keyHash authdb.KeyHash) (err error)
- func (d *KV) DeleteUnused(ctx context.Context, asOfSystemInterval time.Duration, ...) (count, rounds int64, deletesPerHead map[string]int64, err error)
- func (d *KV) Get(ctx context.Context, keyHash authdb.KeyHash) (*authdb.Record, error)
- func (d *KV) GetWithNonDefaultAsOfInterval(ctx context.Context, keyHash authdb.KeyHash, asOfSystemInterval time.Duration) (_ *authdb.Record, err error)
- func (d *KV) Invalidate(ctx context.Context, keyHash authdb.KeyHash, reason string) (err error)
- func (d *KV) MigrateToLatest(ctx context.Context) (err error)
- func (d *KV) Migration(ctx context.Context) *migrate.Migration
- func (d *KV) PingDB(ctx context.Context) (err error)
- func (d *KV) Put(ctx context.Context, keyHash authdb.KeyHash, record *authdb.Record) (err error)
- func (d *KV) PutAtTime(ctx context.Context, keyHash authdb.KeyHash, record *authdb.Record, ...) (err error)
- func (d *KV) Run(ctx context.Context) error
- func (d *KV) Schema() string
- func (d *KV) TagSQL() tagsql.DB
- func (d *KV) TestingSetCleanup(cleanup func() error)
- func (d *KV) UnderlyingDB() *dbx.DB
- type Options
- type RebindableTagSQL
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("sqlauth")
Error is default error class for sqlauth package.
Functions ¶
Types ¶
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV is a key/value store backed by a sql database.
func (*KV) Delete ¶
Delete removes the record from the key/value store. It is not an error if the key does not exist.
func (*KV) DeleteUnused ¶
func (d *KV) DeleteUnused(ctx context.Context, asOfSystemInterval time.Duration, selectSize, deleteSize int) (count, rounds int64, deletesPerHead map[string]int64, err error)
DeleteUnused deletes expired and invalid records from the key/value store in batches as specified by the selectSize and deleteSize parameters and returns any error encountered. It uses database time to avoid problems with invalid time on the server.
func (*KV) GetWithNonDefaultAsOfInterval ¶
func (d *KV) GetWithNonDefaultAsOfInterval(ctx context.Context, keyHash authdb.KeyHash, asOfSystemInterval time.Duration) (_ *authdb.Record, err error)
GetWithNonDefaultAsOfInterval retrieves the record from the key/value store using the specific asOfSystemInterval.
func (*KV) Invalidate ¶
Invalidate causes the record to become invalid. It is not an error if the key does not exist. It does not update the invalid reason if the record is already invalid.
func (*KV) MigrateToLatest ¶
MigrateToLatest migrates the kv store to the latest version of the schema.
func (*KV) Migration ¶
Migration returns table migrations. The SQL here represent the step-wise changes to the database.
func (*KV) PingDB ¶ added in v1.29.0
PingDB attempts to do a database roundtrip and returns an error if it can't.
func (*KV) PutAtTime ¶ added in v1.37.1
func (d *KV) PutAtTime(ctx context.Context, keyHash authdb.KeyHash, record *authdb.Record, createdAt time.Time) (err error)
PutAtTime stores the record at a specific time. It is an error if the key already exists.
func (*KV) TestingSetCleanup ¶
TestingSetCleanup is used to set the callback for cleaning up test database.
func (*KV) UnderlyingDB ¶ added in v1.30.0
UnderlyingDB returns the underlying database.
type Options ¶
type Options struct {
ApplicationName string
}
Options includes options for how a connection is made.
type RebindableTagSQL ¶
RebindableTagSQL offers a version of tagsql.DB which exposed a SQL Rebind() method.
func (RebindableTagSQL) Rebind ¶
func (db RebindableTagSQL) Rebind(sql string) string
Rebind allows rewrites SQL parameter syntax as required in Migration.Run().