storage

package
v0.0.0-...-f62d8aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 7 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL