Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Database dialects DialectMySQL = "mysql" DialectPostgres = "prostgres" DialectSqlite3 = "sqlite3" DialectSqlServer = "sqlserver" )
Variables ¶
View Source
var ( // Errors ErrUserExists = errors.New("The username, email or phone number already exists") )
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // GetUser returns the user for the given user ID. This ID is not to be // confused with the records ID in the table but the generated value for the // user_id field. GetUser(id string) (models.User, error) // GetUserByName returns the user for the given name. This name can be // either the username or email address of the user as an identifier. GetUserByName(name string) (models.User, error) // SaveUser adds the given user to the database. It should fill in the // remaining fields like the record and user ID. SaveUser(user models.User) (models.User, error) // SetPublicKey updates the user for the given user ID and sets the user's // public key. SetPublicKey(userId, pubKey string) error // UpdateTotp updates the TOTP state of the user for the given user ID. // Either enabling TOTP and/or setting its value itself. UpdateTotp(enable bool, totp, userId string) error // UpdateTokens updates the user's access and refresh token for the given // user ID. UpdateTokens(token, refreshToken, userId string) error }
Database represents an interface to the authentication database and the management of users.
Click to show internal directories.
Click to hide internal directories.