data

package
v0.0.0-...-c2164b1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 17 Imported by: 0

README

Data

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewData, NewUserRepo)

ProviderSet is data providers.

Functions

func NewMysql

func NewMysql(c *conf.Data_Mysql) (db *gorm.DB, err error)

func NewRedis

func NewRedis(ctx context.Context, data *conf.Data_Redis) (client *redis.Client, err error)

func NewUserRepo

func NewUserRepo(data *Data, logger log.Logger) biz.UserRepo

NewuserRepo .

func RecordNotFound

func RecordNotFound(db *gorm.DB) (ret bool)

RecordNotFound First、Last、Take 这些预期会返回结果的方法查询记录时,才会返回 ErrRecordNotFound

Types

type Data

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

Data .

func NewData

func NewData(c *conf.Data, logger log.Logger) (*Data, func(), error)

NewData .

type User

type User struct {
	Id         int64          `gorm:"column:id;primaryKey;type:bigint;index;comment:数据id"`
	UserName   string         `gorm:"column:username;type:varchar(32);uniqueIndex;comment:用户名"`
	Password   string         `gorm:"column:password;type:varchar(32);comment:密码,纯md5,未加盐"`
	Email      string         `gorm:"column:email;type:varchar(64);index;comment:密码,纯md5,未加盐"`
	Avatar     string         `gorm:"column:avatar;type:text;comment:头像地址"`
	Status     biz.UserStatus `gorm:"column:status;type:tinyint;default:1"`
	CreateTime int64          `gorm:"column:create_time;type:bigint;not null"`
	UpdateTime int64          `gorm:"column:update_time;type:bigint;not null"`
	DeleteTime int64          `gorm:"column:delete_time;type:bigint;default:0;comment:删除时间"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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