Documentation ¶
Index ¶
- Constants
- type Selector
- type SelectorType
- type SetOnInsert
- type Update
- func (u Update) Any(t, k string, v interface{})
- func (u Update) Convert(t string, i interface{}) error
- func (u Update) Has(filed string) bool
- func (u Update) Inc(k string, v interface{})
- func (u Update) Max(k string, v interface{})
- func (u Update) Min(k string, v interface{})
- func (u Update) Pop(k string, v interface{})
- func (u Update) Projection() bson.M
- func (u Update) Pull(k string, v interface{})
- func (u Update) Push(k string, v interface{})
- func (u Update) Set(k string, v interface{})
- func (u Update) SetOnInert(k string, v interface{})
- func (u Update) String() string
- func (u Update) Transform(sch *schema.Schema) Update
- func (u Update) UnSet(k string, v interface{})
Constants ¶
View Source
const ( UpdateTypeSet = "$set" UpdateTypeInc = "$inc" UpdateTypeUnset = "$unset" UpdateTypeSetOnInsert = "$setOnInsert" )
View Source
const MongodbFieldSplit = "."
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Selector ¶ added in v0.0.3
type Selector struct {
// contains filtered or unexported fields
}
func (*Selector) Omit ¶ added in v0.0.3
Omit specify fields that you want to ignore when creating, updating and querying
func (*Selector) Projection ¶ added in v0.0.3
Projection 获取字段,如果sch!=nil && this.selector == SelectorTypeOmit 全部翻转成 Select模式 FindOneAndUpdate 时有用,其他模式传nil
type SelectorType ¶ added in v0.0.3
type SelectorType int8
const ( SelectorTypeNone SelectorType = iota SelectorTypeOmit SelectorTypeSelect )
type SetOnInsert ¶
type Update ¶
func Build ¶
Build 使用当前模型,将map bson.m Struct 转换成Update 如果设置了model i为bson.m可以使用数据库名和model名 selects 针对Struct更新时选择,或者忽略的字段,如果为空,更新所有非零值字段
func (Update) Projection ¶
func (Update) SetOnInert ¶
Click to show internal directories.
Click to hide internal directories.