Step one: Copy the struct definitions over into a new, dedicated submodule Step two: Make a generator script Step three: Define helper functions for various queries
This commit is contained in:
parent
0639cde4f2
commit
714f528641
27 changed files with 983 additions and 0 deletions
26
storage-new/models/UserAuthenticationMethod.go
Normal file
26
storage-new/models/UserAuthenticationMethod.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package models
|
||||
|
||||
import "database/sql/driver"
|
||||
|
||||
type AuthenticationMethodType string
|
||||
|
||||
const (
|
||||
AuthMethodPassword AuthenticationMethodType = "password"
|
||||
AuthMethodGAuth AuthenticationMethodType = "g-auth" // Google Authenticator / totp
|
||||
AuthMethodMail AuthenticationMethodType = "mail"
|
||||
AuthMethodPasskey2fa AuthenticationMethodType = "passkey-2fa" // Passkey used as 2fa factor
|
||||
AuthMethodPasskey AuthenticationMethodType = "passkey" // Passkey as only auth key
|
||||
)
|
||||
|
||||
var AllAuthMethods = []AuthenticationMethodType{
|
||||
AuthMethodPassword, AuthMethodGAuth, AuthMethodMail, AuthMethodPasskey, AuthMethodPasskey2fa,
|
||||
}
|
||||
|
||||
func (ct *AuthenticationMethodType) Scan(value any) error {
|
||||
*ct = AuthenticationMethodType(value.([]byte))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ct AuthenticationMethodType) Value() (driver.Value, error) {
|
||||
return string(ct), nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue