数据库 model 使用文档
小于 1 分钟
自动生成以下方法
type xxModel interface {
Insert(ctx context.Context, session sqlx.Session, data *CasbinRule) (sql.Result, error)
InsertWithCache(ctx context.Context, session sqlx.Session, data *CasbinRule) (sql.Result, error)
FindOne(ctx context.Context, session sqlx.Session, id int64) (*CasbinRule, error)
FindOneWithCache(ctx context.Context, session sqlx.Session, id int64) (*CasbinRule, error)
Update(ctx context.Context, session sqlx.Session, data *CasbinRule) error
UpdateWithCache(ctx context.Context, session sqlx.Session, data *CasbinRule) error
Delete(ctx context.Context, session sqlx.Session, id int64) error
DeleteWithCache(ctx context.Context, session sqlx.Session, id int64) error
// custom interface generated by jzero
BulkInsert(ctx context.Context, session sqlx.Session, datas []*CasbinRule) error
FindByCondition(ctx context.Context, session sqlx.Session, conds ...condition.Condition) ([]*CasbinRule, error)
FindOneByCondition(ctx context.Context, session sqlx.Session, conds ...condition.Condition) (*CasbinRule, error)
PageByCondition(ctx context.Context, session sqlx.Session, conds ...condition.Condition) ([]*CasbinRule, int64, error)
UpdateFieldsByCondition(ctx context.Context, session sqlx.Session, field map[string]any, conds ...condition.Condition) error
DeleteByCondition(ctx context.Context, session sqlx.Session, conds ...condition.Condition) error
}