repositories

package
v0.0.0-...-8e2a637 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyConflict   = errors.New("Key Conflict")
	ErrDataNotFound  = errors.New("Record Not Found")
	ErrUserExists    = errors.New("User already exists")
	ErrWrongPassword = errors.New("Wrong password")
)

Repository errors

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Db *gorm.DB
}

Repository the repository structure

func (*Repository) CreateRepository

func (r *Repository) CreateRepository(db *gorm.DB)

CreateRepository create the repository

type UserRepository

type UserRepository struct {
	Repository
}

UserRepository the user repository

func (*UserRepository) Create

func (r *UserRepository) Create(user *models.User) error

Create the user

func (*UserRepository) GetFirstByEmail

func (r *UserRepository) GetFirstByEmail(email string) (*models.User, error)

GetFirstByEmail gets the user by his email

func (*UserRepository) Login

func (r *UserRepository) Login(email, password string) (*models.User, error)

Login the user if the password is correct

Jump to

Keyboard shortcuts

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