Documentation ¶
Index ¶
- Constants
- Variables
- func NewToSearchValue(v interface{}) (b toSearchValue, err error)
- type BSON
- func (b BSON) Array() (arr []interface{})
- func (b BSON) FastContains(v toSearchValue) bool
- func (b BSON) Lookup(key string) (val Value)
- func (b BSON) Map() (vals M)
- func (b BSON) MustToJson() (s []byte)
- func (b BSON) String() string
- func (b BSON) ToJson() (s []byte, err error)
- func (b BSON) ToValueArray() (arr []Value)
- func (b BSON) ToValueMap() (vals map[string]Value)
- func (b BSON) Unmarshal(out interface{}) (err error)
- type BSONEX
- type Binary
- type DBPointer
- type Decoder
- type M
- type MongoTimestamp
- type ObjectId
- type RegEx
- type Value
- func (v Value) Array() (a []interface{})
- func (v Value) ArrayOf(i int) Value
- func (v Value) Binary() Binary
- func (v Value) Bool() bool
- func (v Value) DBPointer() DBPointer
- func (v Value) Document() BSON
- func (v Value) Float64() float64
- func (v Value) GetBSON() (interface{}, error)
- func (v Value) Int32() int32
- func (v Value) Int64() int64
- func (v Value) IsEmpty() bool
- func (v Value) IsMaxKey() bool
- func (v Value) IsMinKey() bool
- func (v Value) IsNull() bool
- func (v Value) IsUndefined() bool
- func (v Value) Map() M
- func (v Value) MarshalBSON() (bs []byte, err error)
- func (v Value) MarshalJSON() (bs []byte, err error)
- func (v Value) MongoTimestamp() MongoTimestamp
- func (v Value) Objid() ObjectId
- func (v Value) RawValue() []byte
- func (v Value) Regexp() RegEx
- func (v Value) Str() string
- func (v Value) String() string
- func (v Value) Time() time.Time
- func (v Value) Type() ValueType
- func (v Value) Uint32() uint32
- func (v Value) Uint64() uint64
- func (v Value) Value() (r interface{})
- func (v Value) ValueArray() (a []Value)
- func (v Value) ValueMap() map[string]Value
- type ValueType
Constants ¶
View Source
const ( TypeEmpty ValueType = iota TypeDouble // 0x01 64-bit binary floating point TypeString // 0x02 UTF-8 string TypeDocument // 0x03 Embedded document TypeArray // 0x04 TypeBinary // 0x05 Binary data TypeUndefined // 0x06 Undefined (value) — Deprecated TypeObjectId // 0x07 TypeBoolean // 0x08 TypeDatetime // 0x09 UTC datetime TypeNull // 0x0A TypeRegex // 0x0B Regular expression TypeDBPointer // 0x0C Deprecated TypeJSCode // 0x0D TypeSymbol // 0x0E Deprecated TypeJSCodeScope // 0x0F Deprecated TypeInt32 // 0x10 TypeTimestamp // 0x11 TypeInt64 // 0x12 TypeDecimal128 // 0x13 128-bit decimal floating point TypeMinKey byte = 0xFF TypeMaxKey byte = 0x7F )
Variables ¶
View Source
var ( Undefined = gbson.Undefined MinKey = gbson.MinKey MaxKey = gbson.MaxKey NewObjectId = gbson.NewObjectId NewMongoTimestamp = gbson.NewMongoTimestamp Marshal = gbson.Marshal Unmarshal = gbson.Unmarshal NewEncoder = gbson.NewEncoder ReadOne = bson.ReadOne )
Functions ¶
func NewToSearchValue ¶ added in v1.1.0
func NewToSearchValue(v interface{}) (b toSearchValue, err error)
Types ¶
type BSON ¶
type BSON []byte
func (BSON) FastContains ¶ added in v1.1.0
FastContains 可以在未解析BSON的时候先快速判断一下是否包含待查找的内容, 避免执行每个文档都执行Unmarshal加快查找速度。 需要注意的是这里查找并不精确,必要的情况下仍然需要再次Unmarshal再确认一次。
func (BSON) MustToJson ¶
func (BSON) ToValueArray ¶ added in v1.2.0
func (BSON) ToValueMap ¶
type Binary ¶
func (Binary) MarshalJSON ¶
type MongoTimestamp ¶ added in v1.2.4
type MongoTimestamp = gbson.MongoTimestamp
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func (Value) IsUndefined ¶
func (Value) MarshalBSON ¶ added in v1.2.1
func (Value) MarshalJSON ¶ added in v1.2.1
func (Value) MongoTimestamp ¶
func (v Value) MongoTimestamp() MongoTimestamp
func (Value) ValueArray ¶ added in v1.2.1
Click to show internal directories.
Click to hide internal directories.