Documentation ¶
Index ¶
- func RunUnitOfWork[T any](ctx context.Context, repo TxBeginner, fn WorkFn[T]) (T, error)
- type APIKey
- type AuthRepository
- type Client
- type ClientPatch
- type ClientRepository
- type Email
- type EmailRepository
- type NewAPIKey
- type NewClient
- type NewEmail
- type NewPassword
- type NewUser
- type NotFoundError
- type Password
- type PasswordRepository
- type QueryOptions
- type Repository
- type Session
- type SessionRepository
- type TxBeginner
- type User
- type UserPatch
- type UserRepository
- type WorkFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunUnitOfWork ¶
Types ¶
type APIKey ¶
type APIKey struct { ID uuid.UUID `json:"id" db:"id"` ClientID uuid.UUID `json:"-" db:"client_id"` Description *string `json:"description" db:"description"` Prefix string `json:"prefix" db:"prefix"` Hash string `json:"-" db:"hash"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
type AuthRepository ¶
type AuthRepository interface {
GetUserPasswordHash(userID uuid.UUID, opts QueryOptions) (string, error)
}
type ClientPatch ¶
func (ClientPatch) ApplyTo ¶
func (p ClientPatch) ApplyTo(client Client) Client
type ClientRepository ¶
type ClientRepository interface { ListClients(opts QueryOptions) ([]Client, error) GetClientById(id uuid.UUID, opts QueryOptions) (Client, error) InsertClient(user NewClient, opts QueryOptions) (uuid.UUID, error) SaveClient(user Client, opts QueryOptions) error DeleteClient(id uuid.UUID, opts QueryOptions) error GetClientAPIKey(clientID uuid.UUID, prefix string, opts QueryOptions) (APIKey, error) ListClientAPIKeys(clientID uuid.UUID, opts QueryOptions) ([]APIKey, error) InsertAPIKey(key NewAPIKey, opts QueryOptions) (uuid.UUID, error) DeleteClientAPIKey(clientID, keyID uuid.UUID, opts QueryOptions) error }
type EmailRepository ¶
type EmailRepository interface {
InsertEmail(email NewEmail, opts QueryOptions) (uuid.UUID, error)
}
type NewPassword ¶
type NewPassword struct { UserID uuid.UUID Hash string }
type NotFoundError ¶
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type PasswordRepository ¶
type PasswordRepository interface {
InsertPassword(password NewPassword, opts QueryOptions) (uuid.UUID, error)
}
type QueryOptions ¶
func (*QueryOptions) Context ¶
func (q *QueryOptions) Context() context.Context
type Repository ¶
type Repository interface { TxBeginner UserRepository PasswordRepository EmailRepository AuthRepository ClientRepository SessionRepository }
type SessionRepository ¶
type SessionRepository interface { GetSession(token string, opts QueryOptions) (Session, error) SaveSession(session Session, opts QueryOptions) error DeleteSession(token string, opts QueryOptions) error }
type UserRepository ¶
type UserRepository interface { ListUsers(opts QueryOptions) ([]User, error) GetUserById(id uuid.UUID, opts QueryOptions) (User, error) GetUserByEmail(email string, opts QueryOptions) (User, error) InsertUser(user NewUser, opts QueryOptions) (uuid.UUID, error) SaveUser(user User, opts QueryOptions) error DeleteUser(id uuid.UUID, opts QueryOptions) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.