dao

package
v0.0.0-...-2f954c6 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, collectionName string, opts ...*DeleteOptions) error

Delete 删除单个数据

func DeleteMany

func DeleteMany(ctx context.Context, collectionName string, filter interface{}) error

DeleteMany 删除多个数据

func Doc2GJson

func Doc2GJson(collectionName string, doc map[string]interface{}, includeHiddenField, includePrivateField bool, fieldNames ...string) *gjson.Json

Doc2GJson 将数据查询结果转换成 gjson

func Docs2GJson

func Docs2GJson(collectionName string, docs []map[string]interface{}, includeHiddenField, includePrivateField bool, fieldNames ...string) *gjson.Json

Docs2GJson 将多个数据查询结果转换成 gjson

func Get

func Get(ctx context.Context, collectionName string, opts ...*GetOptions) (*gjson.Json, error)

Get 获取单个数据

func Insert

func Insert(ctx context.Context, collectionName string, doc interface{}, opts ...*InsertOptions) (string, error)

Insert 新建单个数据

func InsertMany

func InsertMany(ctx context.Context, collectionName string, docs ...interface{}) ([]string, error)

InsertMany 新建多个数据

func List

func List(ctx context.Context, collectionName string, opts ...*ListOptions) (*gjson.Json, int, error)

List 获取列表数据

func Update

func Update(ctx context.Context, collectionName string, doc interface{}, opts ...*UpdateOptions) error

Update 更新单个数据

func UpdateMany

func UpdateMany(ctx context.Context, collectionName string, doc interface{}, filter interface{}) error

UpdateMany 更新多个数据

func Upsert

func Upsert(ctx context.Context, collectionName string, doc interface{}, opts ...*UpsertOptions) error

Upsert 保存单个数据

Types

type DeleteOptions

type DeleteOptions struct {
	Filter        interface{}
	RaiseNotFound bool
	CtxUser       types.ContextUser
}

DeleteOptions .

type GetOptions

type GetOptions struct {
	Filter              interface{}
	Fields              []string
	IgnoreFieldsCheck   bool
	IncludeHiddenField  bool
	IncludePrivateField bool
	RaiseNotFound       bool
	CtxUser             types.ContextUser
}

GetOptions .

type InsertOptions

type InsertOptions struct {
	IgnoreFieldValueCheck bool
	IncludeHiddenField    bool
	IncludePrivateField   bool
	CtxUser               types.ContextUser
}

InsertOptions .

type ListOptions

type ListOptions struct {
	Filter              interface{}
	Fields              []string
	Sort                []string
	Limit               int64
	Offset              int64
	IgnoreFieldsCheck   bool
	IncludeHiddenField  bool
	IncludePrivateField bool
	CtxUser             types.ContextUser
}

ListOptions .

type UpdateOptions

type UpdateOptions struct {
	Filter                interface{}
	IgnoreFieldValueCheck bool
	IncludeHiddenField    bool
	IncludePrivateField   bool
	CtxUser               types.ContextUser
}

UpdateOptions .

type UpsertOptions

type UpsertOptions struct {
	Filter                interface{}
	IgnoreFieldValueCheck bool
	IncludeHiddenField    bool
	IncludePrivateField   bool
	CtxUser               types.ContextUser
}

UpsertOptions .

Jump to

Keyboard shortcuts

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