Documentation ¶
Overview ¶
Package store defines the storage interface for miniblog.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// 全局变量,方便其它包直接调用已初始化好的 S 实例.
S *datastore
)
Functions ¶
Types ¶
type IStore ¶
type IStore interface { DB(ctx context.Context) *gorm.DB TX(ctx context.Context, fn func(ctx context.Context) error) error Users() UserStore Posts() PostStore }
IStore 定义了 Store 层需要实现的方法.
type PostExpansion ¶
type PostExpansion interface{}
PostExpansion defines additional methods for post operations.
type PostStore ¶
type PostStore interface { Create(ctx context.Context, obj *model.PostM) error Update(ctx context.Context, obj *model.PostM) error Delete(ctx context.Context, opts *where.WhereOptions) error Get(ctx context.Context, opts *where.WhereOptions) (*model.PostM, error) List(ctx context.Context, opts *where.WhereOptions) (int64, []*model.PostM, error) PostExpansion }
PostStore 定义了 post 模块在 store 层所实现的方法.
type UserExpansion ¶
type UserExpansion interface{}
UserExpansion defines additional methods for user operations.
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.WhereOptions) error Get(ctx context.Context, opts *where.WhereOptions) (*model.UserM, error) List(ctx context.Context, opts *where.WhereOptions) (int64, []*model.UserM, error) UserExpansion }
UserStore 定义了 user 模块在 store 层所实现的方法.
Click to show internal directories.
Click to hide internal directories.