restapi

package
v0.0.0-...-40778be Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(
	c *znet.Context,
	store *model.Store,
	filter model.Filter,
	handler func(old ztype.Map) error,
) (any, error)

Delete 删除多条数据

func DeleteById

func DeleteById(
	c *znet.Context,
	store *model.Store,
	id string,
	handler func(old ztype.Map) error,
) (any, error)

DeleteById 删除一条数据

func Find

func Find(
	c *znet.Context,
	store *model.Store,
	filter model.Filter,
	fn func(o *model.CondOptions),
) (ztype.Maps, error)

Find 获取多条数据

func FindById

func FindById(
	c *znet.Context,
	store *model.Store,
	id string,
	fn func(o *model.CondOptions),
) (ztype.Map, error)

FindById 获取一条数据

func HanderPageRelation

func HanderPageRelation(c *znet.Context, oper *model.Store, filter model.Filter, relations map[string]Relation) (*model.PageData, error)

func HanderPageRelation2

func HanderPageRelation2(data *model.PageData, relations map[string]Relation) (*model.PageData, error)

func HanderUpload

func HanderUpload(c *znet.Context, subDirName string, opt ...func(o *common.UploadOption)) ([]common.UploadResult, error)

func Insert

func Insert(
	c *znet.Context,
	store *model.Store,
	fn func(data ztype.Map) (ztype.Map, error),
	o ...func(io *model.InsertOptions),
) (ztype.Map, error)

Insert 添加数据

func InsertMany

func InsertMany(
	c *znet.Context,
	store *model.Store,
	fn func(i int, data ztype.Map) (ztype.Map, error),
	o ...func(io *model.InsertOptions),
) (ztype.Map, error)

InsertMany 添加多条数据

func Page

func Page(
	c *znet.Context,
	store *model.Store,
	filter model.Filter,
	fn func(o *model.CondOptions),
) (*model.PageData, error)

Page 获取分页数据

func UpdateById

func UpdateById(
	c *znet.Context,
	store *model.Store,
	id string,
	handler func(old ztype.Map, data ztype.Map) (ztype.Map, error),
) (any, error)

UpdateById 更新一条数据

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

func New

func New(o ...func(options *Options)) *Module

func (Module) Controller

func (m Module) Controller() []service.Controller

func (Module) Done

func (m Module) Done(invoker zdi.Invoker) error

func (Module) Load

func (m Module) Load(invoker zdi.Invoker) (any, error)

func (Module) Name

func (m Module) Name() string

func (Module) Start

func (m Module) Start(invoker zdi.Invoker) error

func (Module) Tasks

func (m Module) Tasks() []service.Task

type Options

type Options struct {
	Middleware   znet.Handler
	ResponseHook func(c *znet.Context, model, args, method string) (next bool)
	Prefix       string
}

type Relation

type Relation struct {
	Operation *model.Store
}

Jump to

Keyboard shortcuts

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