update

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	UpdateTypeSet         = "$set"
	UpdateTypeInc         = "$inc"
	UpdateTypeSetOnInsert = "$setOnInsert"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Update

type Update map[string]bson.M

func Build

func Build(i interface{}, store *schema.Options, model interface{}) (update Update, err error)

Build 使用当前模型,将map bson.m Struct 转换成Update 如果设置了model,model除主键和零值外其他键值一律作为SetOnInsert值 如果设置了model i为bson.m可以使用数据库名和model名

func New

func New() Update

func (Update) Any

func (u Update) Any(t, k string, v interface{})

func (Update) Convert

func (u Update) Convert(t string, i interface{}) error

func (Update) Has

func (u Update) Has(filed string) bool

func (Update) Inc

func (u Update) Inc(k string, v interface{})

func (Update) Max

func (u Update) Max(k string, v interface{})

func (Update) Min

func (u Update) Min(k string, v interface{})

func (Update) Pop

func (u Update) Pop(k string, v interface{})

func (Update) Pull

func (u Update) Pull(k string, v interface{})

func (Update) Push

func (u Update) Push(k string, v interface{})

func (Update) Set

func (u Update) Set(k string, v interface{})

func (Update) SetOnInert

func (u Update) SetOnInert(k string, v interface{})

func (Update) String

func (u Update) String() string

func (Update) UnSet

func (u Update) UnSet(k string, v interface{})

Jump to

Keyboard shortcuts

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