sqlite

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Conn          *sqlx.DB
	UUIDGenerator UUIDGenerator
}

func NewDB

func NewDB(dsn string) (DB, error)

func (DB) BeginTx

func (db DB) BeginTx(ctx context.Context) (*sqlx.Tx, error)

func (DB) DeleteClient

func (db DB) DeleteClient(id uuid.UUID, opts store.QueryOptions) error

func (DB) DeleteClientAPIKey

func (db DB) DeleteClientAPIKey(clientID, keyID uuid.UUID, opts store.QueryOptions) error

func (DB) DeleteSession

func (db DB) DeleteSession(token string, opts store.QueryOptions) error

func (DB) DeleteUser

func (db DB) DeleteUser(id uuid.UUID, opts store.QueryOptions) error

func (DB) GetClientAPIKey

func (db DB) GetClientAPIKey(clientID uuid.UUID, prefix string, opts store.QueryOptions) (store.APIKey, error)

func (DB) GetClientById

func (db DB) GetClientById(id uuid.UUID, opts store.QueryOptions) (store.Client, error)

func (DB) GetSession

func (db DB) GetSession(token string, opts store.QueryOptions) (store.Session, error)

func (DB) GetUserByEmail

func (db DB) GetUserByEmail(email string, opts store.QueryOptions) (store.User, error)

func (DB) GetUserById

func (db DB) GetUserById(id uuid.UUID, opts store.QueryOptions) (store.User, error)

func (DB) GetUserPasswordHash

func (db DB) GetUserPasswordHash(userID uuid.UUID, opts store.QueryOptions) (string, error)

func (DB) InsertAPIKey

func (db DB) InsertAPIKey(key store.NewAPIKey, opts store.QueryOptions) (uuid.UUID, error)

func (DB) InsertClient

func (db DB) InsertClient(client store.NewClient, opts store.QueryOptions) (uuid.UUID, error)

func (DB) InsertEmail

func (db DB) InsertEmail(email store.NewEmail, opts store.QueryOptions) (uuid.UUID, error)

func (DB) InsertPassword

func (db DB) InsertPassword(password store.NewPassword, opts store.QueryOptions) (uuid.UUID, error)

func (DB) InsertUser

func (db DB) InsertUser(user store.NewUser, opts store.QueryOptions) (uuid.UUID, error)

func (DB) ListClientAPIKeys

func (db DB) ListClientAPIKeys(clientID uuid.UUID, opts store.QueryOptions) ([]store.APIKey, error)

func (DB) ListClients

func (db DB) ListClients(opts store.QueryOptions) ([]store.Client, error)

func (DB) ListUsers

func (db DB) ListUsers(opts store.QueryOptions) ([]store.User, error)

func (DB) SaveClient

func (db DB) SaveClient(client store.Client, opts store.QueryOptions) error

func (DB) SaveSession

func (db DB) SaveSession(session store.Session, opts store.QueryOptions) error

func (DB) SaveUser

func (db DB) SaveUser(user store.User, opts store.QueryOptions) error

type Querier

type Querier interface {
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
}

type UUIDGenerator

type UUIDGenerator interface {
	GenerateUUID() uuid.UUID
}

Jump to

Keyboard shortcuts

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