db

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationsFS embed.FS

MigrationsFS holds Atlas migration files. Embed the entire directory so it works even when no migrations exist yet.

Functions

func ConfigureDB

func ConfigureDB(db *sql.DB) error

ConfigureDB enables the SQLite connection policy Stella relies on. Connection-level pragmas are safe here because OpenDB constrains each handle to a single long-lived underlying connection.

func OpenDB

func OpenDB(dbPath string) (*sql.DB, error)

OpenDB opens a SQLite database at the given path, configures it (WAL mode, foreign keys, busy timeout) and runs migrations. The parent directory is created if it doesn't exist.

Types

type AuthStore

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

AuthStore implements auth.AuthStore using sqlc queries backed by SQLite.

func NewAuthStore

func NewAuthStore(db *sql.DB) *AuthStore

NewAuthStore creates a new AuthStore wrapping the given database connection.

func (*AuthStore) AssignAgent

func (s *AuthStore) AssignAgent(ctx context.Context, userID int64, agentID string) error

func (*AuthStore) CountUsers

func (s *AuthStore) CountUsers(ctx context.Context) (int64, error)

func (*AuthStore) CreateIdentity

func (s *AuthStore) CreateIdentity(ctx context.Context, i auth.Identity) (auth.Identity, error)

func (*AuthStore) CreatePolicy

func (s *AuthStore) CreatePolicy(ctx context.Context, p auth.Policy) (auth.Policy, error)

func (*AuthStore) CreateSession

func (s *AuthStore) CreateSession(ctx context.Context, sess auth.Session) (auth.Session, error)

func (*AuthStore) CreateUser

func (s *AuthStore) CreateUser(ctx context.Context, username, passwordHash string) (auth.AuthUser, error)

func (*AuthStore) CreateUserToken

func (s *AuthStore) CreateUserToken(ctx context.Context, token auth.UserToken) (auth.UserToken, error)

func (*AuthStore) DeleteExpiredSessions

func (s *AuthStore) DeleteExpiredSessions(ctx context.Context) error

func (*AuthStore) DeleteIdentity

func (s *AuthStore) DeleteIdentity(ctx context.Context, id int64) error

func (*AuthStore) DeletePolicy

func (s *AuthStore) DeletePolicy(ctx context.Context, id string) error

func (*AuthStore) DeleteSession

func (s *AuthStore) DeleteSession(ctx context.Context, id string) error

func (*AuthStore) DeleteUser

func (s *AuthStore) DeleteUser(ctx context.Context, id int64) error

func (*AuthStore) DeleteUserSessions

func (s *AuthStore) DeleteUserSessions(ctx context.Context, userID int64) error

func (*AuthStore) GetActiveAutoUserToken

func (s *AuthStore) GetActiveAutoUserToken(ctx context.Context, userID int64) (auth.UserToken, error)

func (*AuthStore) GetActiveUserTokenByHash

func (s *AuthStore) GetActiveUserTokenByHash(ctx context.Context, tokenHash string) (auth.UserToken, error)

func (*AuthStore) GetIdentity

func (s *AuthStore) GetIdentity(ctx context.Context, id int64) (auth.Identity, error)

func (*AuthStore) GetIdentityByPlatform

func (s *AuthStore) GetIdentityByPlatform(ctx context.Context, platform, externalID string) (auth.Identity, error)

func (*AuthStore) GetPolicy

func (s *AuthStore) GetPolicy(ctx context.Context, id string) (auth.Policy, error)

func (*AuthStore) GetSession

func (s *AuthStore) GetSession(ctx context.Context, id string) (auth.Session, error)

func (*AuthStore) GetUser

func (s *AuthStore) GetUser(ctx context.Context, id int64) (auth.AuthUser, error)

func (*AuthStore) GetUserByUsername

func (s *AuthStore) GetUserByUsername(ctx context.Context, username string) (auth.AuthUser, error)

func (*AuthStore) GetUserTokenByHash

func (s *AuthStore) GetUserTokenByHash(ctx context.Context, tokenHash string) (auth.UserToken, error)

func (*AuthStore) ListAgentUserIDs

func (s *AuthStore) ListAgentUserIDs(ctx context.Context, agentID string) ([]int64, error)

func (*AuthStore) ListEnabledPolicies

func (s *AuthStore) ListEnabledPolicies(ctx context.Context) ([]auth.Policy, error)

func (*AuthStore) ListIdentitiesByUser

func (s *AuthStore) ListIdentitiesByUser(ctx context.Context, userID int64) ([]auth.Identity, error)

func (*AuthStore) ListPolicies

func (s *AuthStore) ListPolicies(ctx context.Context) ([]auth.Policy, error)

func (*AuthStore) ListUserAgentIDs

func (s *AuthStore) ListUserAgentIDs(ctx context.Context, userID int64) ([]string, error)

func (*AuthStore) ListUsers

func (s *AuthStore) ListUsers(ctx context.Context) ([]auth.AuthUser, error)

func (*AuthStore) RemoveAgent

func (s *AuthStore) RemoveAgent(ctx context.Context, userID int64, agentID string) error

func (*AuthStore) RevokeUserToken

func (s *AuthStore) RevokeUserToken(ctx context.Context, id int64) (int64, error)

func (*AuthStore) RotateUserToken

func (s *AuthStore) RotateUserToken(ctx context.Context, id int64) (int64, error)

func (*AuthStore) UpdateIdentityExternalID

func (s *AuthStore) UpdateIdentityExternalID(ctx context.Context, id int64, externalID string) error

func (*AuthStore) UpdatePolicy

func (s *AuthStore) UpdatePolicy(ctx context.Context, p auth.Policy) error

func (*AuthStore) UpdateSessionExpiry

func (s *AuthStore) UpdateSessionExpiry(ctx context.Context, id string, expiresAt time.Time) error

func (*AuthStore) UpdateUser

func (s *AuthStore) UpdateUser(ctx context.Context, u auth.AuthUser) error

func (*AuthStore) UpdateUserAgeKeys

func (s *AuthStore) UpdateUserAgeKeys(ctx context.Context, userID int64, publicKey, privateKey string) error

func (*AuthStore) UpdateUserDefaultAgent

func (s *AuthStore) UpdateUserDefaultAgent(ctx context.Context, userID int64, agentID string) error

func (*AuthStore) UpdateUserNotifyIdentity

func (s *AuthStore) UpdateUserNotifyIdentity(ctx context.Context, userID int64, identityID *int64) error

func (*AuthStore) UpdateUserRole

func (s *AuthStore) UpdateUserRole(ctx context.Context, userID int64, role string) error

func (*AuthStore) UpdateUserTokenLastUsed

func (s *AuthStore) UpdateUserTokenLastUsed(ctx context.Context, id int64) (int64, error)

Jump to

Keyboard shortcuts

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