user

package
v0.0.0-...-902682f Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUserRepo

func CreateUserRepo(conn *gorm.DB) users.Repository

func ToListDomain

func ToListDomain(data []User) (result []users.Domain)

Types

type User

type User struct {
	Id        int `gorm:"primaryKey"`
	Name      string
	Username  string
	Password  string
	Email     string
	Address   string
	Status    string
	Token     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func FromDomain

func FromDomain(domain users.Domain) User

func (*User) ToDomain

func (user *User) ToDomain() users.Domain

type UserRepo

type UserRepo struct {
	DB *gorm.DB
}

func (*UserRepo) Create

func (rep *UserRepo) Create(ctx context.Context, userR *users.Domain) (users.Domain, error)

func (*UserRepo) Delete

func (rep *UserRepo) Delete(ctx context.Context, id int) error

func (*UserRepo) GetAll

func (rep *UserRepo) GetAll(ctx context.Context) ([]users.Domain, error)

func (*UserRepo) GetByEmail

func (rep *UserRepo) GetByEmail(ctx context.Context, email string) (users.Domain, error)

func (*UserRepo) GetById

func (rep *UserRepo) GetById(ctx context.Context, id int) (users.Domain, error)

func (*UserRepo) GetByToken

func (rep *UserRepo) GetByToken(ctx context.Context, token string) (users.Domain, error)

func (*UserRepo) GetByUsername

func (rep *UserRepo) GetByUsername(ctx context.Context, username string) (users.Domain, error)

func (*UserRepo) Login

func (rep *UserRepo) Login(ctx context.Context, username string, password string) (users.Domain, error)

func (*UserRepo) Update

func (rep *UserRepo) Update(ctx context.Context, userU users.Domain) (users.Domain, error)

Jump to

Keyboard shortcuts

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