userrepo

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProviderProductionSet provides a UserRepository for Production.
	ProviderProductionSet = wire.NewSet(Provide, wire.Bind(new(domain.UserRepository), new(*UserRepository)))
)

Functions

This section is empty.

Types

type UserRepository

type UserRepository struct {
	DB *gorm.DB
}

UserRepository is a repository that holds information about Users backed by a database.

func Provide

func Provide(manager *database.Manager) *UserRepository

Provide provides provides a UserRepository configured with the given Manager.

func (*UserRepository) Create

func (u *UserRepository) Create(user *domain.User) (uint, error)

Create creates the given user in the database.

func (*UserRepository) Delete

func (u *UserRepository) Delete(ID uint) error

Delete deletes the User with the given ID.

func (*UserRepository) GetAll

func (u *UserRepository) GetAll() ([]*domain.User, error)

GetAll gets all of the users in the database.

func (*UserRepository) GetByID

func (u *UserRepository) GetByID(ID uint) (*domain.User, error)

GetByID retrieves a User based on the given ID.

func (*UserRepository) GetByUsername

func (u *UserRepository) GetByUsername(username string) (*domain.User, error)

GetByUsername retrieves a User based on the given username.

func (*UserRepository) Update

func (u *UserRepository) Update(user *domain.User) error

Update updates the given User. The ID of the given User needs to be set in order to find the existing record in the database.

Jump to

Keyboard shortcuts

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