Documentation
¶
Overview ¶
nolint: dupl
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// 全局变量,方便其它包直接调用已初始化好的 datastore 实例.
S *datastore
)
Functions ¶
Types ¶
type IStore ¶
type IStore interface {
// 返回 Store 层的 *gorm.DB 实例,在少数场景下会被用到.
DB(ctx context.Context, wheres ...where.Where) *gorm.DB
TX(ctx context.Context, fn func(ctx context.Context) error) error
User() UserStore
}
IStore 定义了 Store 层需要实现的方法.
type Logger ¶
type Logger struct{}
Logger is a logger that implements the Logger interface. It uses the log package to log error messages with additional context.
type UserStore ¶
type UserStore interface {
Create(ctx context.Context, obj *model.UserM) error
Update(ctx context.Context, obj *model.UserM) error
Delete(ctx context.Context, opts *where.Options) error
Get(ctx context.Context, opts *where.Options) (*model.UserM, error)
List(ctx context.Context, opts *where.Options) (int64, []*model.UserM, error)
UserExpansion
}
UserStore 定义了 user 模块在 store 层所实现的方法.
Click to show internal directories.
Click to hide internal directories.