Documentation
¶
Index ¶
- Variables
- type Config
- type DB
- func (db *DB) Account(id int64) (*hmm.Account, error)
- func (db *DB) AccountWithCredentials(email, allegedPassword string) (*hmm.Account, error)
- func (db *DB) Accounts() (hmm.Accounts, error)
- func (db *DB) AddRoleToAccount(roleID, accountID int64) (*hmm.AccountRole, error)
- func (db *DB) CleanSessionsOlderThan(age time.Duration) (int64, error)
- func (db *DB) Confirm(id int64) (*hmm.Confirmation, error)
- func (db *DB) CreateAccount(ctx context.Context, a *hmm.Account, password, confirmationCode string) (*hmm.Account, *hmm.Confirmation, error)
- func (db *DB) CreateConfirmation(accountID int64, t hmm.ConfirmationType) (*hmm.Confirmation, error)
- func (db *DB) CreateRole(name string) (*hmm.Role, error)
- func (db *DB) CreateSession(ctx context.Context, email, password string) (*hmm.Session, error)
- func (db *DB) ExpireSession(token string) (*hmm.Session, error)
- func (db *DB) FailedConfirmationIncrease(id int64) (*hmm.Confirmation, error)
- func (db *DB) PendingConfirmationByKey(key string) (*hmm.Confirmation, error)
- func (db *DB) PopulateAccount(a *hmm.Account) *hmm.Account
- func (db *DB) PopulateAccounts(accs hmm.Accounts) hmm.Accounts
- func (db *DB) Role(id int64) (*hmm.Role, error)
- func (db *DB) Roles() (hmm.Roles, error)
- func (db *DB) RolesForAccount(accountID int64) (hmm.Roles, error)
- func (db *DB) SessionFromToken(token string) (*hmm.Session, error)
- func (db *DB) UpdateRole(roleID int64, permissionBit int) (*hmm.Role, error)
- func (db *DB) UpdateSession(token string) (*hmm.Session, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExpiredResource error ErrInvalidCredentials = errors.New("invalid credentials") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB represents the database
func (*DB) AccountWithCredentials ¶
AccountWithCredentials returns an account if the email and password provided match an (email,password) pair in the db
func (*DB) AddRoleToAccount ¶
func (db *DB) AddRoleToAccount(roleID, accountID int64) (*hmm.AccountRole, error)
func (*DB) CleanSessionsOlderThan ¶
CleanSessionsOlderThan deletes all sessions older than age(in seconds) and returns the number of rows affected
func (*DB) CreateAccount ¶
func (db *DB) CreateAccount(ctx context.Context, a *hmm.Account, password, confirmationCode string) (*hmm.Account, *hmm.Confirmation, error)
CreateAccount creates a new account in the db and a confirmation code for the new registered email
func (*DB) CreateConfirmation ¶
func (db *DB) CreateConfirmation(accountID int64, t hmm.ConfirmationType) (*hmm.Confirmation, error)
func (*DB) CreateRole ¶
CreateRole creates a new role with the given name
func (*DB) CreateSession ¶
CreateSession creates a new session
func (*DB) ExpireSession ¶
ExpireSession expires the session with the given token
func (*DB) FailedConfirmationIncrease ¶
func (db *DB) FailedConfirmationIncrease(id int64) (*hmm.Confirmation, error)
func (*DB) PendingConfirmationByKey ¶
func (db *DB) PendingConfirmationByKey(key string) (*hmm.Confirmation, error)
func (*DB) RolesForAccount ¶
RolesForAccount fetches all roles for the given account
func (*DB) SessionFromToken ¶
SessionFromToken fetches a session by its token
func (*DB) UpdateRole ¶
Click to show internal directories.
Click to hide internal directories.