Documentation ¶
Overview ¶
Package storage provides the Storer, which has all the methods to query the underlying storage database.
Index ¶
- type Options
- type Storer
- func (s *Storer) Connect() error
- func (s *Storer) Login(ctx context.Context, email, password string) (*model.User, error)
- func (s *Storer) MigrateDown() error
- func (s *Storer) MigrateTo(version uint) error
- func (s *Storer) MigrateUp() error
- func (s *Storer) Ping(ctx context.Context) error
- func (s *Storer) Signup(ctx context.Context, name, email, password string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { User string Password string Host string Port int Socket string Name string Logger *log.Logger }
Options for New.
type Storer ¶
Storer is the storage abstraction.
func New ¶
New returns a new Storer with the given options. If no logger is provided, the logs are discarded.
func (*Storer) Login ¶
Login with a given email and password. The password is cleartext and hashed here. Returns the user if succesful, without the password. Note that the password comparison is done no matter what, to combat timing attacks. See https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#compare-password-hashes-using-safe-functions
func (*Storer) MigrateTo ¶
MigrateTo a specific version. No database connection should be present already, MigrateTo handles connecting.