update

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 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 SetOnInsert

type SetOnInsert interface {
	SetOnInsert() (map[string]interface{}, error)
}

type Update

type Update map[string]bson.M

func Build

func Build(i interface{}, stmt statement.Statement) (update Update, err error)

Build 使用当前模型,将map bson.m Struct 转换成Update 如果设置了model i为bson.m可以使用数据库名和model名 selects 针对Struct更新时选择,或者忽略的字段,如果为空,更新所有非零值字段

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

func (u Update) Projection() bson.M

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