Documentation ¶
Index ¶
- type DB
- func (db *DB) Account(id int64) (*models.Account, error)
- func (db *DB) AccountExists(email string) (bool, error)
- func (db *DB) AccountWithCredentials(email, allegedPassword string) (*models.Account, error)
- func (db *DB) Accounts() (models.Accounts, error)
- func (db *DB) AddAccountRole(roleID, accountID int64) (*models.AccountRole, error)
- func (db *DB) CleanSessionsOlderThan(age time.Duration) (int64, error)
- func (db *DB) Confirm(id int64) (*models.Confirmation, error)
- func (db *DB) CreateAccount(first, last, email, password, confirmationCode string, dob time.Time, ...) (*models.Account, *models.Confirmation, error)
- func (db *DB) CreateConfirmation(accountID int64, t models.ConfirmationType) (*models.Confirmation, error)
- func (db *DB) CreateRole(name string) (*models.Role, error)
- func (db *DB) CreateSession(accountID int64) (*models.Session, error)
- func (db *DB) DeleteSession(identifier string) error
- func (db *DB) FailedConfirmationIncrease(id int64) (*models.Confirmation, error)
- func (db *DB) PendingConfirmationByKey(key string) (*models.Confirmation, error)
- func (db *DB) Role(roleID int64) (*models.Role, error)
- func (db *DB) RoleExists(name string) (bool, error)
- func (db *DB) Roles() (models.Roles, error)
- func (db *DB) RolesForAccount(accountID int64) (models.Roles, error)
- func (db *DB) SessionFromIdentifier(identifier string) (*models.Session, error)
- func (db *DB) UpdateSession(sessionToken string) (*models.Session, error)
- type DatabaseConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB represents the database
func (*DB) AccountExists ¶
AccountExists returns true if the provided email exists in the db
func (*DB) AccountWithCredentials ¶
AccountWithCredentials returns an account if the email and password provided match an (email,password) pair in the db
func (*DB) AddAccountRole ¶
func (db *DB) AddAccountRole(roleID, accountID int64) (*models.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(first, last, email, password, confirmationCode string, dob time.Time, gender, phone *string) (*models.Account, *models.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 models.ConfirmationType) (*models.Confirmation, error)
func (*DB) CreateRole ¶
CreateRole creates a new role with the given name
func (*DB) CreateSession ¶
CreateSession creates a new session
func (*DB) DeleteSession ¶
DeleteSession deletes the session with the given identifier
func (*DB) FailedConfirmationIncrease ¶
func (db *DB) FailedConfirmationIncrease(id int64) (*models.Confirmation, error)
func (*DB) PendingConfirmationByKey ¶
func (db *DB) PendingConfirmationByKey(key string) (*models.Confirmation, error)
func (*DB) RoleExists ¶
RoleExists returns true if already exists a role with the provided name in the db
func (*DB) RolesForAccount ¶
RolesForAccount fetches all roles for the given account
func (*DB) SessionFromIdentifier ¶
SessionFromIdentifier fetches a session from a given its identifier