repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const UsersCollection = "users"

Variables

This section is empty.

Functions

This section is empty.

Types

type URepository

type URepository struct {
	// contains filtered or unexported fields
}

URepository provides a mongo collection for database job.

func (*URepository) DeleteAll

func (r *URepository) DeleteAll() error

DeleteAll drops users collection.

func (*URepository) DeleteById

func (r *URepository) DeleteById(id string) error

Delete deletes the user based on id.

func (*URepository) GetAll

func (r *URepository) GetAll() (user []*models.User, err error)

GetAll returns all users.

func (*URepository) GetByEmail

func (r *URepository) GetByEmail(email string) (user *models.User, err error)

GetByEmail returns the user based on email.

func (*URepository) GetById

func (r *URepository) GetById(id string) (user *models.User, err error)

GetById returns the user based on id.

func (*URepository) Save

func (r *URepository) Save(user *models.User) error

Save creates a user.

func (*URepository) Update

func (r *URepository) Update(user *models.User) error

Update updates the user.

type UsersRepository

type UsersRepository interface {
	Save(user *models.User) error
	GetById(id string) (user *models.User, err error)
	GetByEmail(email string) (user *models.User, err error)
	GetAll() (user []*models.User, err error)
	Update(user *models.User) error
	DeleteById(id string) error
}

UsersRepository is the interface of the authentication backend.

func NewUsersRepository

func NewUsersRepository(conn db.Connection) UsersRepository

NewUsersRepository creates a new UsersRepository instance.

Jump to

Keyboard shortcuts

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