data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 17 Imported by: 0

README

Data

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is data providers.

Functions

func NewDiscovery

func NewDiscovery(conf *conf.Registry) registry.Discovery

func NewExampleRepo

func NewExampleRepo(data *Data, logger log.Logger) biz.ExampleRepo

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 NewRegistrar

func NewRegistrar(conf *conf.Registry) registry.Registrar

func Paginate

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

Paginate 分页

Types

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)

type ExampleEntity

type ExampleEntity struct {
	BaseFields
	Name   string `gorm:"type:varchar(255);not null;comment:名称"`
	Status bool   `gorm:"not null;comment:状态0冻结1正常"`
	Domain string `gorm:"type:varchar(255);not null;comment:域"`
}

func (ExampleEntity) TableName

func (ExampleEntity) TableName() string

type ExampleRepo

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

func (ExampleRepo) CreateExample

func (r ExampleRepo) CreateExample(ctx context.Context, example *domain.Example) (*domain.Example, error)

func (ExampleRepo) DeleteExample

func (r ExampleRepo) DeleteExample(ctx context.Context, domain *domain.Example) error

func (ExampleRepo) GetExample

func (r ExampleRepo) GetExample(ctx context.Context, params map[string]interface{}) (*domain.Example, error)

func (ExampleRepo) GetExampleByParams

func (r ExampleRepo) GetExampleByParams(ctx context.Context, params map[string]interface{}) (record *ExampleEntity, err error)

func (ExampleRepo) GetExampleCount

func (r ExampleRepo) GetExampleCount(ctx context.Context, params map[string]interface{}) (count int64, err error)

func (ExampleRepo) ListExample

func (r ExampleRepo) ListExample(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Example, error)

func (ExampleRepo) RecoverExample

func (r ExampleRepo) RecoverExample(ctx context.Context, domain *domain.Example) error

func (ExampleRepo) UpdateExample

func (r ExampleRepo) UpdateExample(ctx context.Context, domain *domain.Example) error

Jump to

Keyboard shortcuts

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