Documentation ¶
Overview ¶
Package db contains models and DAO interfaces that packages db/postgresdb and db/mockdb will implement.
This is intended to be the primary way that the underlying application stores and fetches data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoSuchUser = errors.New("db: no such user")
)
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { Username string `db:"username"` Email string `db:"email"` PasswordHash string `db:"password_hash"` IsAdmin bool `db:"is_admin"` IsDJ bool `db:"is_dj"` TwitterHandle string `db:"twitter_handle"` }
User is a logical "user" account created for administrators or DJ's to log in and make API calls.
type UserDAOer ¶
type UserDAOer interface { // Register will create a new user account with the given credentials // or fail with a given error. Register(info User, password string) (*User, error) // Login returns a User instance if the given username and password // are the same as the ones in the database. Login(username, password string) (ok bool, user *User, err error) // Info returns information about a user in the database. Info(username string) (*User, error) }
UserDAOer is a common interface for all of the database calls involving user accounts (logging in, registration, etc.)
Click to show internal directories.
Click to hide internal directories.