Documentation
¶
Index ¶
- Variables
- type Controller
- func (x *Controller) BulkCreate(ctx context.Context, c *app.RequestContext)
- func (x *Controller) BulkDelete(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Create(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Delete(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Find(ctx context.Context, c *app.RequestContext)
- func (x *Controller) FindById(ctx context.Context, c *app.RequestContext)
- func (x *Controller) FindOne(ctx context.Context, c *app.RequestContext)
- func (x *Controller) In(r *route.RouterGroup)
- func (x *Controller) Replace(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Size(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Sort(ctx context.Context, c *app.RequestContext)
- func (x *Controller) Transform(data M, format M) (err error)
- func (x *Controller) Update(ctx context.Context, c *app.RequestContext)
- func (x *Controller) UpdateById(ctx context.Context, c *app.RequestContext)
- type M
- type Service
- func (x *Service) BulkCreate(ctx context.Context, model string, docs []interface{}) (_ interface{}, err error)
- func (x *Service) BulkDelete(ctx context.Context, model string, filter M) (_ interface{}, err error)
- func (x *Service) Create(ctx context.Context, model string, doc M) (_ interface{}, err error)
- func (x *Service) Delete(ctx context.Context, model string, id primitive.ObjectID) (_ interface{}, err error)
- func (x *Service) Find(ctx context.Context, model string, filter M, option *options.FindOptions) (data []M, err error)
- func (x *Service) FindOne(ctx context.Context, model string, filter M, option *options.FindOneOptions) (data M, err error)
- func (x *Service) Replace(ctx context.Context, model string, id primitive.ObjectID, doc M) (_ interface{}, err error)
- func (x *Service) Size(ctx context.Context, model string, filter M) (_ int64, err error)
- func (x *Service) Sort(ctx context.Context, model string, ids []primitive.ObjectID) (_ interface{}, err error)
- func (x *Service) Update(ctx context.Context, model string, filter M, update M) (_ interface{}, err error)
- func (x *Service) UpdateById(ctx context.Context, model string, id primitive.ObjectID, update M) (_ interface{}, err error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
DslService *Service
}
func (*Controller) BulkCreate ¶
func (x *Controller) BulkCreate(ctx context.Context, c *app.RequestContext)
BulkCreate 批量新增资源 @router /dsl/:model/bulk-create [POST]
func (*Controller) BulkDelete ¶
func (x *Controller) BulkDelete(ctx context.Context, c *app.RequestContext)
BulkDelete 批量删除匹配资源 @router /dsl/:model/bulk-delete [POST]
func (*Controller) Create ¶
func (x *Controller) Create(ctx context.Context, c *app.RequestContext)
Create 新增资源 @router /dsl/:model [POST]
func (*Controller) Delete ¶
func (x *Controller) Delete(ctx context.Context, c *app.RequestContext)
Delete 删除指定 ID 的资源 @router /dsl/:model/:id [DELETE]
func (*Controller) Find ¶
func (x *Controller) Find(ctx context.Context, c *app.RequestContext)
Find 获取匹配资源 @router /dsl/:model [GET]
func (*Controller) FindById ¶
func (x *Controller) FindById(ctx context.Context, c *app.RequestContext)
FindById 获取指定 ID 的资源 @router /dsl/:model/:id [GET]
func (*Controller) FindOne ¶
func (x *Controller) FindOne(ctx context.Context, c *app.RequestContext)
FindOne 获取单个资源 @router /dsl/:model/_one [GET]
func (*Controller) In ¶ added in v0.0.28
func (x *Controller) In(r *route.RouterGroup)
func (*Controller) Replace ¶
func (x *Controller) Replace(ctx context.Context, c *app.RequestContext)
Replace 替换指定 ID 的资源 @router /dsl/:model/:id [PUT]
func (*Controller) Size ¶
func (x *Controller) Size(ctx context.Context, c *app.RequestContext)
Size 获取资源总数 @router /dsl/:model/_size [GET]
func (*Controller) Sort ¶
func (x *Controller) Sort(ctx context.Context, c *app.RequestContext)
Sort 排序资源 @router /dsl/:model/sort [POST]
func (*Controller) Transform ¶
func (x *Controller) Transform(data M, format M) (err error)
Transform 格式转换
func (*Controller) Update ¶
func (x *Controller) Update(ctx context.Context, c *app.RequestContext)
Update 局部更新匹配资源 @router /dsl/:model [PATCH]
func (*Controller) UpdateById ¶
func (x *Controller) UpdateById(ctx context.Context, c *app.RequestContext)
UpdateById 局部更新指定 ID 的资源 @router /dsl/:model/:id [PATCH]
type Service ¶
func (*Service) BulkCreate ¶
func (x *Service) BulkCreate(ctx context.Context, model string, docs []interface{}) (_ interface{}, err error)
BulkCreate 批量新增资源
func (*Service) BulkDelete ¶
func (x *Service) BulkDelete(ctx context.Context, model string, filter M) (_ interface{}, err error)
BulkDelete 批量删除匹配资源
func (*Service) Delete ¶
func (x *Service) Delete(ctx context.Context, model string, id primitive.ObjectID) (_ interface{}, err error)
Delete 删除指定 ID 的资源
func (*Service) Find ¶
func (x *Service) Find(ctx context.Context, model string, filter M, option *options.FindOptions) (data []M, err error)
Find 获取匹配资源
func (*Service) FindOne ¶
func (x *Service) FindOne(ctx context.Context, model string, filter M, option *options.FindOneOptions) (data M, err error)
FindOne 获取单个资源
func (*Service) Replace ¶
func (x *Service) Replace(ctx context.Context, model string, id primitive.ObjectID, doc M) (_ interface{}, err error)
Replace 替换指定 ID 的资源
func (*Service) Sort ¶
func (x *Service) Sort(ctx context.Context, model string, ids []primitive.ObjectID) (_ interface{}, err error)
Sort 排序资源