Documentation ¶
Overview ¶
Package storage is responsible for storing and retrieving users
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is responsible for storing and retrieving users
func New ¶
func New(ctx context.Context, host string, database string, user string, password string) (*Storage, error)
New creates a new Storage given the database address,user and the password to securely connect to it. It automatically tries again to connect if something goes wrong until the given ctx is cancelled or achieves its deadline.
func (*Storage) AddUser ¶
func (s *Storage) AddUser( ctx context.Context, email users.Email, fullname string, hashedPassword string, ) (string, error)
AddUser adds a user with the given parameters, returning its ID in the case of success or an error otherwise. If an user with the given email already exists it returns users.UserAlreadyExistsErr
Click to show internal directories.
Click to hide internal directories.