data

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 16 Imported by: 0

README

Data

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is data providers.

Functions

func NewAdministratorRepo

func NewAdministratorRepo(data *Data, logger log.Logger) biz.AdministratorRepo

func NewMysqlCmd

func NewMysqlCmd(conf *conf.Bootstrap, logger log.Logger) *gorm.DB

func NewRedisClient

func NewRedisClient(conf *conf.Data) *redis.Client

func NewRedisCmd

func NewRedisCmd(conf *conf.Data, logger log.Logger) redis.Cmdable

func Paginate

func Paginate(page, pageSize int64) func(db *gorm.DB) *gorm.DB

Paginate 分页

Types

type AdministratorEntity

type AdministratorEntity struct {
	BaseFields
	Domain        string `gorm:"type:varchar(255);not null;comment:域"`
	Status        bool   `gorm:"not null;comment:状态0冻结1正常"`
	Username      string `gorm:"type:varchar(255);not null;unique;comment:用户名"`
	Password      string `gorm:"type:varchar(255);not null;comment:密码"`
	Salt          string `gorm:"type:varchar(255);not null;comment:密码盐"`
	Mobile        string `gorm:"type:varchar(255);not null;comment:手机号"`
	Nickname      string `gorm:"type:varchar(255);not null;comment:昵称"`
	Avatar        string `gorm:"type:varchar(255);not null;comment:头像"`
	Role          string `gorm:"type:varchar(255);not null;comment:角色"`
	LastLoginTime string `gorm:"type:varchar(255);not null;comment:上次登录时间"`
	LastLoginIp   string `gorm:"type:varchar(255);not null;comment:上次登录ip"`
}

func (AdministratorEntity) TableName

func (AdministratorEntity) TableName() string

type AdministratorRepo

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

func (AdministratorRepo) AdministratorStatusChange

func (repo AdministratorRepo) AdministratorStatusChange(ctx context.Context, id int64, status bool) (bool, error)

func (AdministratorRepo) CreateAdministrator

func (repo AdministratorRepo) CreateAdministrator(ctx context.Context, domain *domain.Administrator) (*domain.Administrator, error)

func (AdministratorRepo) DeleteAdministrator

func (repo AdministratorRepo) DeleteAdministrator(ctx context.Context, domain *domain.Administrator) error

func (AdministratorRepo) GetAdministrator

func (repo AdministratorRepo) GetAdministrator(ctx context.Context, params map[string]interface{}) (*domain.Administrator, error)

func (AdministratorRepo) GetAdministratorByParams

func (repo AdministratorRepo) GetAdministratorByParams(ctx context.Context, params map[string]interface{}) (record *AdministratorEntity, err error)

func (AdministratorRepo) ListAdministrator

func (repo AdministratorRepo) ListAdministrator(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Administrator, int64, error)

func (AdministratorRepo) RecoverAdministrator

func (repo AdministratorRepo) RecoverAdministrator(ctx context.Context, domain *domain.Administrator) error

func (AdministratorRepo) UpdateAdministrator

func (repo AdministratorRepo) UpdateAdministrator(ctx context.Context, domain *domain.Administrator) error

func (AdministratorRepo) UpdateAdministratorLoginInfo

func (repo AdministratorRepo) UpdateAdministratorLoginInfo(ctx context.Context, id int64, ip string, time string) (bool, error)

func (AdministratorRepo) VerifyAdministratorPassword

func (repo AdministratorRepo) VerifyAdministratorPassword(ctx context.Context, id int64, password string) (bool, error)

type BaseFields

type BaseFields struct {
	Id        int64          `gorm:"primarykey;type:int;comment:主键id"`
	CreatedAt time.Time      `gorm:"column:created_at;not null;comment:创建时间"`
	UpdatedAt time.Time      `gorm:"column:updated_at;not null;comment:更新时间"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间"`
}

type Data

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

Data .

func NewData

func NewData(cfg *conf.Bootstrap, db *gorm.DB, redisCli *redis.Client, logger log.Logger) (*Data, func(), error)

Jump to

Keyboard shortcuts

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