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: 13 Imported by: 0

README

Data

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is data providers.

Functions

func NewLogRepo

func NewLogRepo(data *Data, logger log.Logger) biz.LogRepo

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

Types

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 LogEntity

type LogEntity struct {
	Id        int64     `gorm:"primarykey;type:int;comment:主键id"`
	Name      string    `gorm:"type:varchar(255);comment:名称"`
	Domain    string    `gorm:"type:varchar(255);comment:域"`
	TraceId   string    `gorm:"type:varchar(255);comment:trace id"`
	Component string    `gorm:"type:varchar(255);comment:请求http/tpc"`
	UserId    string    `gorm:"type:varchar(255);comment:用户Id"`
	Username  string    `gorm:"type:varchar(255);comment:用户名"`
	Role      string    `gorm:"type:varchar(255);comment:角色"`
	Method    string    `gorm:"type:varchar(255);comment:请求方式"`
	Operation string    `gorm:"type:varchar(255);comment:kratos操作"`
	Path      string    `gorm:"type:varchar(255);comment:请求path"`
	Request   string    `gorm:"type:text;comment:请求参数"`
	Code      string    `gorm:"type:varchar(255);comment:返回code"`
	Reason    string    `gorm:"type:varchar(255);comment:返回reason"`
	IP        string    `gorm:"type:varchar(255);comment:IP"`
	Latency   string    `gorm:"type:varchar(255);comment:响应时长"`
	CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间"`
}

func (LogEntity) TableName

func (LogEntity) TableName() string

type LogRepo

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

func (LogRepo) CreateLog

func (r LogRepo) CreateLog(ctx context.Context, domain *domain.Log) error

func (LogRepo) GetLogCount

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

func (LogRepo) ListLog

func (r LogRepo) ListLog(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Log, error)

Jump to

Keyboard shortcuts

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