repo

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebAuthnUser

func NewWebAuthnUser(ctx context.Context, log *logrus.Entry, repo *Repo, usr models.User) webauthn.User

func Query

func Query[T any](ctx context.Context, stmt stmts.Statement[T], conn *gorqlite.Connection, args any) ([]T, error)

func QueryOne

func QueryOne[T any](ctx context.Context, stmt stmts.Statement[T], conn *gorqlite.Connection, args any) (T, error)

Types

type Repo

type Repo struct {
	Conn *gorqlite.Connection
}

func New

func New(endpoint string) (*Repo, error)

func (*Repo) AddUserAddress

func (repo *Repo) AddUserAddress(ctx context.Context, address models.Address) (models.Address, error)

func (*Repo) AddUserPhoneNumber

func (repo *Repo) AddUserPhoneNumber(ctx context.Context, model models.PhoneNumber) (models.PhoneNumber, error)

func (*Repo) AddWebauthnCred

func (repo *Repo) AddWebauthnCred(ctx context.Context, userID string, cred webauthn.Credential, ua useragent.UserAgent) error

func (*Repo) AssignRoleToUser

func (repo *Repo) AssignRoleToUser(ctx context.Context, userID string, roleID string) error

func (*Repo) CheckAndDeleteRecoveryCode

func (repo *Repo) CheckAndDeleteRecoveryCode(ctx context.Context, userID string, code string) error

func (*Repo) CreateRegistrationToken

func (repo *Repo) CreateRegistrationToken(ctx context.Context, token models.RegistrationToken) error

func (*Repo) CreateRole

func (repo *Repo) CreateRole(ctx context.Context, group models.Role) (models.Role, error)

func (*Repo) CreateUser

func (repo *Repo) CreateUser(ctx context.Context, user models.User) (models.User, error)

func (*Repo) CreateUserEmail

func (repo *Repo) CreateUserEmail(ctx context.Context, mail models.EMail) (models.EMail, error)

func (*Repo) CreateWebPushSubscriptionForUser added in v1.1.0

func (repo *Repo) CreateWebPushSubscriptionForUser(ctx context.Context, userID string, userAgent string, tokenID string, sub webpush.Subscription) (string, error)

func (*Repo) DeleteEMailFromUser

func (repo *Repo) DeleteEMailFromUser(ctx context.Context, userID string, mailID string) error

func (*Repo) DeleteRejectedTokens

func (repo *Repo) DeleteRejectedTokens(ctx context.Context, threshold time.Time) error

func (*Repo) DeleteRole

func (repo *Repo) DeleteRole(ctx context.Context, id string) error

func (*Repo) DeleteUser

func (repo *Repo) DeleteUser(ctx context.Context, id string) error

func (*Repo) DeleteUserAddress

func (repo *Repo) DeleteUserAddress(ctx context.Context, userID, addressID string) error

func (*Repo) DeleteUserPhoneNumber

func (repo *Repo) DeleteUserPhoneNumber(ctx context.Context, userID string, phoneNumberID string) error

func (*Repo) DeleteWebPushSubscriptionByID added in v1.1.0

func (repo *Repo) DeleteWebPushSubscriptionByID(ctx context.Context, id string) error

func (*Repo) DeleteWebPushSubscriptionForToken added in v1.1.0

func (repo *Repo) DeleteWebPushSubscriptionForToken(ctx context.Context, tokenID string) error

func (*Repo) GetAddressesByID

func (repo *Repo) GetAddressesByID(ctx context.Context, userID, id string) (models.Address, error)

func (*Repo) GetPasskeys

func (repo *Repo) GetPasskeys(ctx context.Context, userID string) ([]models.Passkey, error)

func (*Repo) GetRoleByID

func (repo *Repo) GetRoleByID(ctx context.Context, id string) (models.Role, error)

func (*Repo) GetRoleByName

func (repo *Repo) GetRoleByName(ctx context.Context, name string) (models.Role, error)

func (*Repo) GetRoles

func (repo *Repo) GetRoles(ctx context.Context) ([]models.Role, error)

func (*Repo) GetUserAddresses

func (repo *Repo) GetUserAddresses(ctx context.Context, userID string) ([]models.Address, error)

func (*Repo) GetUserByEMail

func (repo *Repo) GetUserByEMail(ctx context.Context, name string) (models.User, bool, error)

func (*Repo) GetUserByID

func (repo *Repo) GetUserByID(ctx context.Context, id string) (models.User, error)

func (*Repo) GetUserByName

func (repo *Repo) GetUserByName(ctx context.Context, name string) (models.User, error)

func (*Repo) GetUserEmailByID

func (repo *Repo) GetUserEmailByID(ctx context.Context, userID, id string) (models.EMail, error)

func (*Repo) GetUserEmails

func (repo *Repo) GetUserEmails(ctx context.Context, userID string) ([]models.EMail, error)

func (*Repo) GetUserPhoneNumberByID

func (repo *Repo) GetUserPhoneNumberByID(ctx context.Context, id, userID string) (models.PhoneNumber, error)

func (*Repo) GetUserPhoneNumbers

func (repo *Repo) GetUserPhoneNumbers(ctx context.Context, userID string) ([]models.PhoneNumber, error)

func (*Repo) GetUserPrimaryMail

func (repo *Repo) GetUserPrimaryMail(ctx context.Context, userID string) (models.EMail, error)

func (*Repo) GetUserPrimaryPhoneNumber

func (repo *Repo) GetUserPrimaryPhoneNumber(ctx context.Context, userID string) (models.PhoneNumber, error)

func (*Repo) GetUserRoles

func (repo *Repo) GetUserRoles(ctx context.Context, userID string) ([]models.Role, error)

func (*Repo) GetUsers

func (repo *Repo) GetUsers(ctx context.Context) ([]models.User, error)

func (*Repo) GetUsersByRole

func (repo *Repo) GetUsersByRole(ctx context.Context, roleID string) ([]models.User, error)

func (*Repo) GetWebPushSubscriptionsForUser added in v1.1.0

func (repo *Repo) GetWebPushSubscriptionsForUser(ctx context.Context, userID string) ([]models.Webpush, error)

func (*Repo) GetWebauthnCreds

func (repo *Repo) GetWebauthnCreds(ctx context.Context, userID string) ([]webauthn.Credential, error)

func (*Repo) IsTokenRejected

func (repo *Repo) IsTokenRejected(ctx context.Context, tokenID string) (bool, error)

func (*Repo) MarkEmailAsPrimary

func (repo *Repo) MarkEmailAsPrimary(ctx context.Context, userID string, mailID string) error

func (*Repo) MarkEmailAsVerified

func (repo *Repo) MarkEmailAsVerified(ctx context.Context, userID string, mailID string) error

func (*Repo) MarkPhoneNumberAsPrimary

func (repo *Repo) MarkPhoneNumberAsPrimary(ctx context.Context, userID string, phoneNumberID string) error

func (*Repo) MarkPhoneNumberAsVerified

func (repo *Repo) MarkPhoneNumberAsVerified(ctx context.Context, userID string, phoneNumberID string) error

func (*Repo) MarkRegistrationTokenUsed

func (repo *Repo) MarkRegistrationTokenUsed(ctx context.Context, token string) error

func (*Repo) MarkTokenRejected

func (repo *Repo) MarkTokenRejected(ctx context.Context, token models.RejectedToken) error

func (*Repo) Migrate

func (repo *Repo) Migrate(ctx context.Context) error

func (*Repo) RemoveUserTotpSecret

func (repo *Repo) RemoveUserTotpSecret(ctx context.Context, userID string) error

func (*Repo) RemoveWebauthnCred

func (repo *Repo) RemoveWebauthnCred(ctx context.Context, userID, id string) error

func (*Repo) ReplaceUserRecoveryCodes

func (repo *Repo) ReplaceUserRecoveryCodes(ctx context.Context, userID string, codes []string) error

func (*Repo) SetUserPassword

func (repo *Repo) SetUserPassword(ctx context.Context, userID string, password string) error

func (*Repo) SetUserTotpSecret

func (repo *Repo) SetUserTotpSecret(ctx context.Context, userID string, totpSecret string) error

func (*Repo) UnassignRoleFromUser

func (repo *Repo) UnassignRoleFromUser(ctx context.Context, userID string, roleID string) error

func (*Repo) UpdateRole

func (repo *Repo) UpdateRole(ctx context.Context, role models.Role) error

func (*Repo) UpdateUser

func (repo *Repo) UpdateUser(ctx context.Context, user models.User) error

func (*Repo) UpdateUserAddress

func (repo *Repo) UpdateUserAddress(ctx context.Context, address models.Address) error

func (*Repo) UserHasRecoveryCodes

func (repo *Repo) UserHasRecoveryCodes(ctx context.Context, userID string) (bool, error)

func (*Repo) ValidateRegistrationToken

func (repo *Repo) ValidateRegistrationToken(ctx context.Context, token string) (models.RegistrationToken, error)

type WebauthnUser

type WebauthnUser struct {
	models.User
	// contains filtered or unexported fields
}

func (*WebauthnUser) WebAuthnCredentials

func (usr *WebauthnUser) WebAuthnCredentials() []webauthn.Credential

func (*WebauthnUser) WebAuthnDisplayName

func (usr *WebauthnUser) WebAuthnDisplayName() string

func (*WebauthnUser) WebAuthnID

func (usr *WebauthnUser) WebAuthnID() []byte

func (*WebauthnUser) WebAuthnIcon

func (usr *WebauthnUser) WebAuthnIcon() string

func (*WebauthnUser) WebAuthnName

func (usr *WebauthnUser) WebAuthnName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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