Help us shape the future of Go! Take the 2026 Go Developer Survey

dsl

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Provides = wire.NewSet(
	wire.Struct(new(Controller), "*"),
	wire.Struct(new(Service), "*"),
)

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 M

type M = map[string]interface{}

type Service

type Service struct {
	Db *mongo.Database
}

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) Create

func (x *Service) Create(ctx context.Context, model string, doc M) (_ interface{}, err error)

Create 新增资源

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) Size

func (x *Service) Size(ctx context.Context, model string, filter M) (_ int64, err error)

Size 获取资源总数

func (*Service) Sort

func (x *Service) Sort(ctx context.Context, model string, ids []primitive.ObjectID) (_ interface{}, err error)

Sort 排序资源

func (*Service) Update

func (x *Service) Update(ctx context.Context, model string, filter M, update M) (_ interface{}, err error)

Update 局部更新匹配资源

func (*Service) UpdateById

func (x *Service) UpdateById(ctx context.Context, model string, id primitive.ObjectID, update M) (_ interface{}, err error)

UpdateById 局部更新指定 ID 的资源

Jump to

Keyboard shortcuts

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