defaultstore

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package defaultstore implements the SQL-backed default store for the Aegis authentication module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultStore

type DefaultStore struct {
	// contains filtered or unexported fields
}

DefaultStore holds all default SQL-based store implementations. It provides a complete implementation of all storage interfaces using sqlc-generated database queries supporting PostgreSQL, MySQL, and SQLite.

In addition to the four store interfaces, DefaultStore implements types.Transactor so callers can compose multiple writes into a single database transaction (used, for example, by AccountService.UpdatePassword to atomically rotate the password and revoke all active sessions).

func NewDefaultStore

func NewDefaultStore(db *sql.DB, dialect types.Dialect) (*DefaultStore, error)

NewDefaultStore creates a new default store for the given dialect. The dialect switch happens exactly once here; all store methods call through the querier interface and are dialect-agnostic.

func (*DefaultStore) AccountStore

func (s *DefaultStore) AccountStore() types.AccountStore

AccountStore returns the default account store implementation.

func (*DefaultStore) BeginTx added in v1.6.0

func (s *DefaultStore) BeginTx(ctx context.Context) (types.Tx, error)

BeginTx opens a database transaction and returns a types.Tx whose store accessors are bound to the transaction. The caller must Commit or Rollback the returned Tx; using `defer tx.Rollback()` immediately after a successful BeginTx call is safe because Rollback after Commit is a no-op.

func (*DefaultStore) SessionStore

func (s *DefaultStore) SessionStore() types.SessionStore

SessionStore returns the default session store implementation.

func (*DefaultStore) UserStore

func (s *DefaultStore) UserStore() types.UserStore

UserStore returns the default user store implementation.

func (*DefaultStore) VerificationStore

func (s *DefaultStore) VerificationStore() types.VerificationStore

VerificationStore returns the default verification store implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL