Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MigrationsFS embed.FS
Functions ¶
func ApplyMeteringMigrations ¶
ApplyMeteringMigrations applies all metering_*.sql migrations from the embedded FS to the given database. Exported for use by testutil and other packages that need an in-memory metering schema for testing.
func ApplyStateMigrations ¶
ApplyStateMigrations applies all state_*.sql migrations from the embedded FS to the given database. It is exported so that testutil and other packages can bring up an in-memory SQLite database with the real schema.
func MeteringPath ¶
MeteringPath returns the metering database path for a state database path.
Types ¶
type Store ¶
func OpenWithMetering ¶
OpenWithMetering is Open with an explicit metering DB path; empty means derived.
func (*Store) RevokeOldest ¶
RevokeOldest finds the oldest (by created_at) non-revoked API key for the given tenant and revokes it. It returns the revoked key's ID, or ("", nil) if no keys exist to revoke.
func (*Store) RevokeOldestExpired ¶
RevokeOldestExpired finds the oldest expired (but not yet revoked) API key for the given tenant and revokes it. It returns the revoked key's ID, or ("", nil) if there are no expired keys to revoke.