repos

package
v0.0.0-...-caa70b2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilEntity = errors.New("entity can not be nil")

Functions

This section is empty.

Types

type UserRepo

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

UserRepo is implementation of ports.UserRepo interface.

func NewUserRepo

func NewUserRepo(db *bun.DB) *UserRepo

NewUserRepo instantiate new UserRepo.

func (*UserRepo) AddRoles

func (repo *UserRepo) AddRoles(ctx context.Context, roleNames []string, id uuid.UUID) error

AddRoles to existing user.

func (*UserRepo) ChangePassword

func (repo *UserRepo) ChangePassword(ctx context.Context, req *user.ChangePasswordRequest) error

ChangePassword updates users password.

func (*UserRepo) Create

func (repo *UserRepo) Create(ctx context.Context, u *user.User) error

Create persists new user entity.

func (*UserRepo) DeleteById

func (repo *UserRepo) DeleteById(ctx context.Context, id uuid.UUID) error

DeleteById remove user entity by specified id.

func (*UserRepo) EnableDisable

func (repo *UserRepo) EnableDisable(ctx context.Context, id uuid.UUID) error

EnableDisable enables user if it is disabled or vice versa.

func (*UserRepo) GetById

func (repo *UserRepo) GetById(ctx context.Context, id uuid.UUID) (*user.User, error)

GetById returns user by specified id.

func (*UserRepo) GetByUsername

func (repo *UserRepo) GetByUsername(ctx context.Context, username string) (*user.User, error)

GetByUsername returns user by username.

func (*UserRepo) GetPage

func (repo *UserRepo) GetPage(ctx context.Context, p domain.Pageable) (domain.Page[user.User], error)

GetPage respond with a page of users.

func (*UserRepo) RemoveRoles

func (repo *UserRepo) RemoveRoles(ctx context.Context, roleNames []string, id uuid.UUID) error

RemoveRoles from existing user.

func (*UserRepo) Update

func (repo *UserRepo) Update(ctx context.Context, u *user.User) error

Update existing persisted user entity.

Jump to

Keyboard shortcuts

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