db

package
v0.0.0-...-c2544de Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRemember2FATokenParams

type CheckRemember2FATokenParams struct {
	UserID   string
	CodeHash []byte
	Now      int64
}

type Client

type Client struct {
	ID           string
	CreatedAt    int64
	Name         string
	Description  string
	Website      string
	RedirectUris []byte
	SecretHash   []byte
	UserID       string
}

type CommitSessionParams

type CommitSessionParams struct {
	Token   string
	Data    []byte
	Expires int64
}

type CreateChangeEmailRequestParams

type CreateChangeEmailRequestParams struct {
	NewEmail        pgtype.Text
	NewEmailToken   []byte
	NewEmailExpires pgtype.Int8
	ID              string
}

type CreateClientParams

type CreateClientParams struct {
	ID           string
	CreatedAt    int64
	Name         string
	Description  string
	Website      string
	RedirectUris []byte
	SecretHash   []byte
	UserID       string
}

type CreateOAuthTokenParams

type CreateOAuthTokenParams struct {
	CreatedAt   int64
	Category    string
	TokenHash   []byte
	RedirectUri string
	ClientID    string
	UserID      string
	Scopes      string
	Data        []byte
	Expires     int64
	Used        bool
}

type CreatePasskeyParams

type CreatePasskeyParams struct {
	ID         string
	CredID     []byte
	Name       string
	CreatedAt  int64
	UserID     string
	Credential []byte
}

type CreateRecoveryCodeParams

type CreateRecoveryCodeParams struct {
	CreatedAt int64
	UserID    string
	CodeHash  []byte
}

type CreateRemember2FATokenParams

type CreateRemember2FATokenParams struct {
	CreatedAt int64
	UserID    string
	CodeHash  []byte
	Expires   int64
}

type CreateTokenParams

type CreateTokenParams struct {
	CreatedAt int64
	Category  string
	TokenKey  string
	ValueHash []byte
	Expires   int64
}

type CreateUserParams

type CreateUserParams struct {
	ID             string
	CreatedAt      int64
	Name           string
	Email          string
	EmailConfirmed bool
	PasswordHash   []byte
	OtpActive      bool
	OtpUrl         string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteClientParams

type DeleteClientParams struct {
	UserID string
	ID     string
}

type DeleteOAuthTokenByUserParams

type DeleteOAuthTokenByUserParams struct {
	ClientID string
	UserID   string
	Now      int64
}

type DeleteOAuthTokenParams

type DeleteOAuthTokenParams struct {
	ClientID  string
	Category  string
	TokenHash []byte
	Now       int64
}

type DeletePasskeyParams

type DeletePasskeyParams struct {
	UserID string
	ID     string
}

type DeleteRecoveryCodeParams

type DeleteRecoveryCodeParams struct {
	UserID   string
	CodeHash []byte
}

type DeleteRemember2FATokenParams

type DeleteRemember2FATokenParams struct {
	UserID   string
	CodeHash []byte
}

type DeleteRemember2FATokensParams

type DeleteRemember2FATokensParams struct {
	UserID string
	Now    int64
}

type DeleteTokenParams

type DeleteTokenParams struct {
	Category string
	TokenKey string
	Now      int64
}

type FindClientByUserAndIDParams

type FindClientByUserAndIDParams struct {
	UserID string
	ID     string
}

type FindOAuthPermissionsParams

type FindOAuthPermissionsParams struct {
	ClientID string
	UserID   string
}

type FindOAuthTokenParams

type FindOAuthTokenParams struct {
	Category  string
	TokenHash []byte
	Now       int64
}

type FindPasskeyParams

type FindPasskeyParams struct {
	UserID string
	ID     string
}

type FindSessionParams

type FindSessionParams struct {
	Token string
	Now   int64
}

type FindSessionsRow

type FindSessionsRow struct {
	Token string
	Data  []byte
}

type FindTokenByValueParams

type FindTokenByValueParams struct {
	Category  string
	ValueHash []byte
	Now       int64
}

type FindTokenParams

type FindTokenParams struct {
	Category string
	TokenKey string
	Now      int64
}

type FindUserByChangeEmailTokenParams

type FindUserByChangeEmailTokenParams struct {
	NewEmailToken []byte
	Now           pgtype.Int8
}

type GetOTPRow

type GetOTPRow struct {
	OtpActive bool
	OtpUrl    string
}

type InsertJWTKeysParams

type InsertJWTKeysParams struct {
	CreatedAt int64
	Private   []byte
	Public    []byte
}

type Oauth

type Oauth struct {
	CreatedAt   int64
	ClientID    string
	Category    string
	TokenHash   []byte
	RedirectUri string
	UserID      string
	Scopes      string
	Data        []byte
	Expires     int64
	Used        bool
}

type Passkey

type Passkey struct {
	ID         string
	CredID     []byte
	Name       string
	CreatedAt  int64
	UserID     string
	Credential []byte
}

type Permission

type Permission struct {
	CreatedAt int64
	ClientID  string
	UserID    string
	Scopes    string
}

type Querier

type Querier interface {
	CheckRemember2FAToken(ctx context.Context, arg CheckRemember2FATokenParams) (bool, error)
	CommitSession(ctx context.Context, arg CommitSessionParams) error
	CountRecoveryCodes(ctx context.Context, userID string) (int64, error)
	CreateChangeEmailRequest(ctx context.Context, arg CreateChangeEmailRequestParams) (pgconn.CommandTag, error)
	CreateClient(ctx context.Context, arg CreateClientParams) (Client, error)
	CreateOAuthToken(ctx context.Context, arg CreateOAuthTokenParams) (Oauth, error)
	CreatePasskey(ctx context.Context, arg CreatePasskeyParams) (pgconn.CommandTag, error)
	CreateRecoveryCode(ctx context.Context, arg CreateRecoveryCodeParams) error
	CreateRemember2FAToken(ctx context.Context, arg CreateRemember2FATokenParams) error
	CreateToken(ctx context.Context, arg CreateTokenParams) (Token, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	DeleteClient(ctx context.Context, arg DeleteClientParams) (pgconn.CommandTag, error)
	DeleteOAuthToken(ctx context.Context, arg DeleteOAuthTokenParams) (pgconn.CommandTag, error)
	DeleteOAuthTokenByUser(ctx context.Context, arg DeleteOAuthTokenByUserParams) error
	DeletePasskey(ctx context.Context, arg DeletePasskeyParams) (pgconn.CommandTag, error)
	DeleteRecoveryCode(ctx context.Context, arg DeleteRecoveryCodeParams) (pgconn.CommandTag, error)
	DeleteRecoveryCodes(ctx context.Context, userID string) (pgconn.CommandTag, error)
	DeleteRemember2FAToken(ctx context.Context, arg DeleteRemember2FATokenParams) (pgconn.CommandTag, error)
	DeleteRemember2FATokens(ctx context.Context, arg DeleteRemember2FATokensParams) (pgconn.CommandTag, error)
	DeleteSession(ctx context.Context, token string) error
	DeleteToken(ctx context.Context, arg DeleteTokenParams) (pgconn.CommandTag, error)
	DeleteUser(ctx context.Context, id string) (pgconn.CommandTag, error)
	FindClient(ctx context.Context, id string) (Client, error)
	FindClientByUser(ctx context.Context, userID string) ([]Client, error)
	FindClientByUserAndID(ctx context.Context, arg FindClientByUserAndIDParams) (Client, error)
	FindOAuthPermissions(ctx context.Context, arg FindOAuthPermissionsParams) (Permission, error)
	FindOAuthToken(ctx context.Context, arg FindOAuthTokenParams) (Oauth, error)
	FindPasskey(ctx context.Context, arg FindPasskeyParams) (Passkey, error)
	FindPasskeys(ctx context.Context, userID string) ([]Passkey, error)
	FindSession(ctx context.Context, arg FindSessionParams) ([]byte, error)
	FindSessions(ctx context.Context, now int64) ([]FindSessionsRow, error)
	FindToken(ctx context.Context, arg FindTokenParams) (Token, error)
	FindTokenByValue(ctx context.Context, arg FindTokenByValueParams) (Token, error)
	FindUser(ctx context.Context, id string) (User, error)
	FindUserByChangeEmailToken(ctx context.Context, arg FindUserByChangeEmailTokenParams) (User, error)
	FindUserByEmail(ctx context.Context, email string) (User, error)
	FindUsers(ctx context.Context) ([]User, error)
	GetJWTKeys(ctx context.Context) (RsaKey, error)
	GetOTP(ctx context.Context, id string) (GetOTPRow, error)
	GetUserPasswordHash(ctx context.Context, id string) ([]byte, error)
	InsertJWTKeys(ctx context.Context, arg InsertJWTKeysParams) error
	RevokeOAuthPermissions(ctx context.Context, arg RevokeOAuthPermissionsParams) (pgconn.CommandTag, error)
	SetOAuthPermissions(ctx context.Context, arg SetOAuthPermissionsParams) (Permission, error)
	SetOTPActive(ctx context.Context, arg SetOTPActiveParams) (pgconn.CommandTag, error)
	UpdateAdminStatus(ctx context.Context, arg UpdateAdminStatusParams) (pgconn.CommandTag, error)
	UpdateClient(ctx context.Context, arg UpdateClientParams) (Client, error)
	UpdateClientSecret(ctx context.Context, arg UpdateClientSecretParams) (pgconn.CommandTag, error)
	UpdateEmail(ctx context.Context, arg UpdateEmailParams) (string, error)
	UpdateEmailConfirmed(ctx context.Context, arg UpdateEmailConfirmedParams) (pgconn.CommandTag, error)
	UpdateOTP(ctx context.Context, arg UpdateOTPParams) (pgconn.CommandTag, error)
	UpdatePasskey(ctx context.Context, arg UpdatePasskeyParams) (pgconn.CommandTag, error)
	UpdatePasskeyCredential(ctx context.Context, arg UpdatePasskeyCredentialParams) (pgconn.CommandTag, error)
	UpdatePassword(ctx context.Context, arg UpdatePasswordParams) (pgconn.CommandTag, error)
	UpdateUserName(ctx context.Context, arg UpdateUserNameParams) (pgconn.CommandTag, error)
	UseOAuthToken(ctx context.Context, arg UseOAuthTokenParams) (pgconn.CommandTag, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CheckRemember2FAToken

func (q *Queries) CheckRemember2FAToken(ctx context.Context, arg CheckRemember2FATokenParams) (bool, error)

func (*Queries) CommitSession

func (q *Queries) CommitSession(ctx context.Context, arg CommitSessionParams) error

func (*Queries) CountRecoveryCodes

func (q *Queries) CountRecoveryCodes(ctx context.Context, userID string) (int64, error)

func (*Queries) CreateChangeEmailRequest

func (q *Queries) CreateChangeEmailRequest(ctx context.Context, arg CreateChangeEmailRequestParams) (pgconn.CommandTag, error)

func (*Queries) CreateClient

func (q *Queries) CreateClient(ctx context.Context, arg CreateClientParams) (Client, error)

func (*Queries) CreateOAuthToken

func (q *Queries) CreateOAuthToken(ctx context.Context, arg CreateOAuthTokenParams) (Oauth, error)

func (*Queries) CreatePasskey

func (q *Queries) CreatePasskey(ctx context.Context, arg CreatePasskeyParams) (pgconn.CommandTag, error)

func (*Queries) CreateRecoveryCode

func (q *Queries) CreateRecoveryCode(ctx context.Context, arg CreateRecoveryCodeParams) error

func (*Queries) CreateRemember2FAToken

func (q *Queries) CreateRemember2FAToken(ctx context.Context, arg CreateRemember2FATokenParams) error

func (*Queries) CreateToken

func (q *Queries) CreateToken(ctx context.Context, arg CreateTokenParams) (Token, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteClient

func (q *Queries) DeleteClient(ctx context.Context, arg DeleteClientParams) (pgconn.CommandTag, error)

func (*Queries) DeleteOAuthToken

func (q *Queries) DeleteOAuthToken(ctx context.Context, arg DeleteOAuthTokenParams) (pgconn.CommandTag, error)

func (*Queries) DeleteOAuthTokenByUser

func (q *Queries) DeleteOAuthTokenByUser(ctx context.Context, arg DeleteOAuthTokenByUserParams) error

func (*Queries) DeletePasskey

func (q *Queries) DeletePasskey(ctx context.Context, arg DeletePasskeyParams) (pgconn.CommandTag, error)

func (*Queries) DeleteRecoveryCode

func (q *Queries) DeleteRecoveryCode(ctx context.Context, arg DeleteRecoveryCodeParams) (pgconn.CommandTag, error)

func (*Queries) DeleteRecoveryCodes

func (q *Queries) DeleteRecoveryCodes(ctx context.Context, userID string) (pgconn.CommandTag, error)

func (*Queries) DeleteRemember2FAToken

func (q *Queries) DeleteRemember2FAToken(ctx context.Context, arg DeleteRemember2FATokenParams) (pgconn.CommandTag, error)

func (*Queries) DeleteRemember2FATokens

func (q *Queries) DeleteRemember2FATokens(ctx context.Context, arg DeleteRemember2FATokensParams) (pgconn.CommandTag, error)

func (*Queries) DeleteSession

func (q *Queries) DeleteSession(ctx context.Context, token string) error

func (*Queries) DeleteToken

func (q *Queries) DeleteToken(ctx context.Context, arg DeleteTokenParams) (pgconn.CommandTag, error)

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id string) (pgconn.CommandTag, error)

func (*Queries) FindClient

func (q *Queries) FindClient(ctx context.Context, id string) (Client, error)

func (*Queries) FindClientByUser

func (q *Queries) FindClientByUser(ctx context.Context, userID string) ([]Client, error)

func (*Queries) FindClientByUserAndID

func (q *Queries) FindClientByUserAndID(ctx context.Context, arg FindClientByUserAndIDParams) (Client, error)

func (*Queries) FindOAuthPermissions

func (q *Queries) FindOAuthPermissions(ctx context.Context, arg FindOAuthPermissionsParams) (Permission, error)

func (*Queries) FindOAuthToken

func (q *Queries) FindOAuthToken(ctx context.Context, arg FindOAuthTokenParams) (Oauth, error)

func (*Queries) FindPasskey

func (q *Queries) FindPasskey(ctx context.Context, arg FindPasskeyParams) (Passkey, error)

func (*Queries) FindPasskeys

func (q *Queries) FindPasskeys(ctx context.Context, userID string) ([]Passkey, error)

func (*Queries) FindSession

func (q *Queries) FindSession(ctx context.Context, arg FindSessionParams) ([]byte, error)

func (*Queries) FindSessions

func (q *Queries) FindSessions(ctx context.Context, now int64) ([]FindSessionsRow, error)

func (*Queries) FindToken

func (q *Queries) FindToken(ctx context.Context, arg FindTokenParams) (Token, error)

func (*Queries) FindTokenByValue

func (q *Queries) FindTokenByValue(ctx context.Context, arg FindTokenByValueParams) (Token, error)

func (*Queries) FindUser

func (q *Queries) FindUser(ctx context.Context, id string) (User, error)

func (*Queries) FindUserByChangeEmailToken

func (q *Queries) FindUserByChangeEmailToken(ctx context.Context, arg FindUserByChangeEmailTokenParams) (User, error)

func (*Queries) FindUserByEmail

func (q *Queries) FindUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) FindUsers

func (q *Queries) FindUsers(ctx context.Context) ([]User, error)

func (*Queries) GetJWTKeys

func (q *Queries) GetJWTKeys(ctx context.Context) (RsaKey, error)

func (*Queries) GetOTP

func (q *Queries) GetOTP(ctx context.Context, id string) (GetOTPRow, error)

func (*Queries) GetUserPasswordHash

func (q *Queries) GetUserPasswordHash(ctx context.Context, id string) ([]byte, error)

func (*Queries) InsertJWTKeys

func (q *Queries) InsertJWTKeys(ctx context.Context, arg InsertJWTKeysParams) error

func (*Queries) RevokeOAuthPermissions

func (q *Queries) RevokeOAuthPermissions(ctx context.Context, arg RevokeOAuthPermissionsParams) (pgconn.CommandTag, error)

func (*Queries) SetOAuthPermissions

func (q *Queries) SetOAuthPermissions(ctx context.Context, arg SetOAuthPermissionsParams) (Permission, error)

func (*Queries) SetOTPActive

func (q *Queries) SetOTPActive(ctx context.Context, arg SetOTPActiveParams) (pgconn.CommandTag, error)

func (*Queries) UpdateAdminStatus

func (q *Queries) UpdateAdminStatus(ctx context.Context, arg UpdateAdminStatusParams) (pgconn.CommandTag, error)

func (*Queries) UpdateClient

func (q *Queries) UpdateClient(ctx context.Context, arg UpdateClientParams) (Client, error)

func (*Queries) UpdateClientSecret

func (q *Queries) UpdateClientSecret(ctx context.Context, arg UpdateClientSecretParams) (pgconn.CommandTag, error)

func (*Queries) UpdateEmail

func (q *Queries) UpdateEmail(ctx context.Context, arg UpdateEmailParams) (string, error)

func (*Queries) UpdateEmailConfirmed

func (q *Queries) UpdateEmailConfirmed(ctx context.Context, arg UpdateEmailConfirmedParams) (pgconn.CommandTag, error)

func (*Queries) UpdateOTP

func (q *Queries) UpdateOTP(ctx context.Context, arg UpdateOTPParams) (pgconn.CommandTag, error)

func (*Queries) UpdatePasskey

func (q *Queries) UpdatePasskey(ctx context.Context, arg UpdatePasskeyParams) (pgconn.CommandTag, error)

func (*Queries) UpdatePasskeyCredential

func (q *Queries) UpdatePasskeyCredential(ctx context.Context, arg UpdatePasskeyCredentialParams) (pgconn.CommandTag, error)

func (*Queries) UpdatePassword

func (q *Queries) UpdatePassword(ctx context.Context, arg UpdatePasswordParams) (pgconn.CommandTag, error)

func (*Queries) UpdateUserName

func (q *Queries) UpdateUserName(ctx context.Context, arg UpdateUserNameParams) (pgconn.CommandTag, error)

func (*Queries) UseOAuthToken

func (q *Queries) UseOAuthToken(ctx context.Context, arg UseOAuthTokenParams) (pgconn.CommandTag, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type RecoveryCode

type RecoveryCode struct {
	CreatedAt int64
	UserID    string
	CodeHash  []byte
}

type Remember2fa

type Remember2fa struct {
	CreatedAt int64
	UserID    string
	CodeHash  []byte
	Expires   int64
}

type RevokeOAuthPermissionsParams

type RevokeOAuthPermissionsParams struct {
	ClientID string
	UserID   string
}

type RsaKey

type RsaKey struct {
	Name      string
	CreatedAt int64
	Private   []byte
	Public    []byte
}

type Session

type Session struct {
	Token   string
	Data    []byte
	Expires int64
}

type SetOAuthPermissionsParams

type SetOAuthPermissionsParams struct {
	CreatedAt int64
	ClientID  string
	UserID    string
	Scopes    string
}

type SetOTPActiveParams

type SetOTPActiveParams struct {
	OtpActive bool
	ID        string
}

type Token

type Token struct {
	CreatedAt int64
	Category  string
	TokenKey  string
	ValueHash []byte
	Expires   int64
}

type UpdateAdminStatusParams

type UpdateAdminStatusParams struct {
	Admin bool
	ID    string
}

type UpdateClientParams

type UpdateClientParams struct {
	Name         string
	Description  string
	Website      string
	RedirectUris []byte
	UserID       string
	ID           string
}

type UpdateClientSecretParams

type UpdateClientSecretParams struct {
	SecretHash []byte
	UserID     string
	ID         string
}

type UpdateEmailConfirmedParams

type UpdateEmailConfirmedParams struct {
	EmailConfirmed bool
	ID             string
}

type UpdateEmailParams

type UpdateEmailParams struct {
	NewEmailToken []byte
	Now           pgtype.Int8
}

type UpdateOTPParams

type UpdateOTPParams struct {
	OtpActive bool
	OtpUrl    string
	ID        string
}

type UpdatePasskeyCredentialParams

type UpdatePasskeyCredentialParams struct {
	Credential []byte
	UserID     string
	CredID     []byte
}

type UpdatePasskeyParams

type UpdatePasskeyParams struct {
	Name   string
	UserID string
	ID     string
}

type UpdatePasswordParams

type UpdatePasswordParams struct {
	PasswordHash []byte
	ID           string
}

type UpdateUserNameParams

type UpdateUserNameParams struct {
	Name string
	ID   string
}

type UseOAuthTokenParams

type UseOAuthTokenParams struct {
	ClientID  string
	Category  string
	TokenHash []byte
}

type User

type User struct {
	ID              string
	CreatedAt       int64
	Name            string
	Email           string
	EmailConfirmed  bool
	PasswordHash    []byte
	OtpActive       bool
	OtpUrl          string
	NewEmail        pgtype.Text
	NewEmailToken   []byte
	NewEmailExpires pgtype.Int8
	Admin           bool
}

Jump to

Keyboard shortcuts

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