user

package
v0.0.0-...-3363d21 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserSet = wire.NewSet(wire.Struct(new(UserRepo), "*"))

Functions

func GetUserDB

func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Types

type User

type User struct {
	ID         uint64     `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	CreatedAt  types.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
	UpdatedAt  types.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP"`
	Username   string     `gorm:"column:username"`
	Password   string     `gorm:"column:password"`
	Avatar     string     `gorm:"column:avatar;default:https://zbj-bucket1.oss-cn-shenzhen.aliyuncs.com/avatar.JPG"`
	UserType   int        `gorm:"column:user_type;default:0;NOT NULL"`
	State      int        `gorm:"column:state;default:1;NOT NULL"`
	CreatedBy  string     `gorm:"column:created_by"`
	ModifiedBy string     `gorm:"column:modified_by"`
}

type UserRepo

type UserRepo struct {
	DB *gorm.DB
}

func (*UserRepo) Create

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

func (*UserRepo) Delete

func (a *UserRepo) Delete(ctx context.Context, id uint64) error

func (*UserRepo) FindOneById

func (a *UserRepo) FindOneById(ctx context.Context, id uint64) (*User, error)

func (*UserRepo) Get

func (a *UserRepo) Get(ctx context.Context, username string) (*User, error)

func (*UserRepo) GetPage

func (a *UserRepo) GetPage(ctx context.Context, pageNum int, pageSize int, name string) (*[]*User, int64, error)

func (*UserRepo) Update

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

Jump to

Keyboard shortcuts

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