data

package
v0.0.0-...-7cfd609 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewUserRepo

func NewUserRepo(d *Data) biz.UserRepo

NewUserRepo 创建 UserRepo 实现(返回 biz.UserRepo 接口)。

func ProvideCache

func ProvideCache(confData *conf.Data) cache.Cache

func ProvideDB

func ProvideDB(confData *conf.Data) *gorm.DB

func ProvideTracerName

func ProvideTracerName() string

Types

type Data

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

Data 数据层聚合结构体 — 封装所有持久化和中间件资源。

func NewData

func NewData(db *gorm.DB, c cache.Cache, tracerName string, logger log.Logger) (*Data, func())

NewData 创建 Data 实例,初始化 OpenTelemetry Tracer。

func (*Data) StartSpan

func (d *Data) StartSpan(ctx context.Context, spanName string) (context.Context, trace.Span)

StartSpan 创建当前操作的 OpenTelemetry Span。

type UserPO

type UserPO struct {
	gorm.Model
	Username string `gorm:"column:username;type:varchar(32);uniqueIndex:idx_users_username,where:deleted_at IS NULL;not null"`
	Email    string `gorm:"column:email;type:varchar(255);uniqueIndex:idx_users_email,where:deleted_at IS NULL;not null"`
	Password string `gorm:"column:password;type:varchar(255);not null" json:"-"`
	Avatar   string `gorm:"column:avatar;type:varchar(512);default:''"`
	Bio      string `gorm:"column:bio;type:text;default:''"`
	Status   int8   `gorm:"column:status;type:smallint;default:0"`
	Role     string `gorm:"column:role;type:varchar(16);default:'reader'"`
}

func (UserPO) TableName

func (UserPO) TableName() string

Jump to

Keyboard shortcuts

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