Documentation ¶
Index ¶
- type DBEnv
- func (env *DBEnv) CountStops() (i int, err error)
- func (env *DBEnv) CreateSession(user *model.User) (*string, error)
- func (env *DBEnv) CreateUser(reg *model.UserRegistration) (*model.User, error)
- func (env *DBEnv) GetStop(id string) (*model.Stop, error)
- func (env *DBEnv) GetStops() (stops []model.Stop, err error)
- func (env *DBEnv) Login(login *model.UserLogin) (*model.User, error)
- func (env *DBEnv) Migrate() error
- func (env *DBEnv) ReplaceAndImportStops(stops []model.Stop) error
- func (env *DBEnv) ResumeSession(token string) (*model.User, error)
- type InitError
- type MigrationError
- type PasswordError
- type QueryError
- type TransactionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBEnv ¶
type DBEnv struct {
// contains filtered or unexported fields
}
DBEnv is the struct that holds this package together
func InitDB ¶
InitDB initializes database access and the connection pool
func (*DBEnv) CreateUser ¶
Creates a new user in the database a QueryError is return if the username already exists (database constraints not met)
func (*DBEnv) Login ¶
Login logs a user in if the password matches the hash in database a PasswordError is return if the passwords do not match a QueryError is returned if the username contains invalid sql characters like %
func (*DBEnv) Migrate ¶
Migrate performs the migrations of the database to the latest schema_version
func (*DBEnv) ReplaceAndImportStops ¶
type InitError ¶
type InitError struct {
// contains filtered or unexported fields
}
database init error
type MigrationError ¶
type MigrationError struct {
// contains filtered or unexported fields
}
database migration error
func (MigrationError) Error ¶
func (e MigrationError) Error() string
func (MigrationError) Unwrap ¶
func (e MigrationError) Unwrap() error
type PasswordError ¶
type PasswordError struct {
// contains filtered or unexported fields
}
Password hash error
func (PasswordError) Error ¶
func (e PasswordError) Error() string
func (PasswordError) Unwrap ¶
func (e PasswordError) Unwrap() error
type QueryError ¶
type QueryError struct {
// contains filtered or unexported fields
}
database query error
func (QueryError) Error ¶
func (e QueryError) Error() string
func (QueryError) Unwrap ¶
func (e QueryError) Unwrap() error
type TransactionError ¶
type TransactionError struct {
// contains filtered or unexported fields
}
database transaction error
func (TransactionError) Error ¶
func (e TransactionError) Error() string
func (TransactionError) Unwrap ¶
func (e TransactionError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.