Versions in this module Expand all Collapse all v1 v1.4.1 Sep 27, 2020 Changes in this version + const TypeArray + const TypeBinary + const TypeBoolean + const TypeCodeWithScope + const TypeDBPointer + const TypeDateTime + const TypeDecimal128 + const TypeDouble + const TypeEmbeddedDocument + const TypeInt32 + const TypeInt64 + const TypeJavaScript + const TypeMaxKey + const TypeMinKey + const TypeNull + const TypeObjectID + const TypeRegex + const TypeString + const TypeSymbol + const TypeTimestamp + const TypeUndefined + var DefaultRegistry = NewRegistryBuilder().Build() + var ErrDecodeToNil = errors.New("cannot Decode to nil value") + var ErrNilContext = errors.New("DecodeContext cannot be nil") + var ErrNilReader = errors.New("nil reader") + var ErrNilRegistry = errors.New("Registry cannot be nil") + func Marshal(val interface{}) ([]byte, error) + func MarshalAppend(dst []byte, val interface{}) ([]byte, error) + func MarshalAppendWithContext(ec bsoncodec.EncodeContext, dst []byte, val interface{}) ([]byte, error) + func MarshalAppendWithRegistry(r *bsoncodec.Registry, dst []byte, val interface{}) ([]byte, error) + func MarshalExtJSON(val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalExtJSONAppend(dst []byte, val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalExtJSONAppendWithContext(ec bsoncodec.EncodeContext, dst []byte, val interface{}, ...) ([]byte, error) + func MarshalExtJSONAppendWithRegistry(r *bsoncodec.Registry, dst []byte, val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalExtJSONWithContext(ec bsoncodec.EncodeContext, val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalExtJSONWithRegistry(r *bsoncodec.Registry, val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalWithContext(ec bsoncodec.EncodeContext, val interface{}) ([]byte, error) + func MarshalWithRegistry(r *bsoncodec.Registry, val interface{}) ([]byte, error) + func NewRegistryBuilder() *bsoncodec.RegistryBuilder + func Unmarshal(data []byte, val interface{}) error + func UnmarshalExtJSON(data []byte, canonical bool, val interface{}) error + func UnmarshalExtJSONWithContext(dc bsoncodec.DecodeContext, data []byte, canonical bool, val interface{}) error + func UnmarshalExtJSONWithRegistry(r *bsoncodec.Registry, data []byte, canonical bool, val interface{}) error + func UnmarshalWithContext(dc bsoncodec.DecodeContext, data []byte, val interface{}) error + func UnmarshalWithRegistry(r *bsoncodec.Registry, data []byte, val interface{}) error + type A = primitive.A + type D = primitive.D + type Decoder struct + func NewDecoder(vr bsonrw.ValueReader) (*Decoder, error) + func NewDecoderWithContext(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader) (*Decoder, error) + func (d *Decoder) Decode(val interface{}) error + func (d *Decoder) Reset(vr bsonrw.ValueReader) error + func (d *Decoder) SetContext(dc bsoncodec.DecodeContext) error + func (d *Decoder) SetRegistry(r *bsoncodec.Registry) error + type E = primitive.E + type Encoder struct + func NewEncoder(vw bsonrw.ValueWriter) (*Encoder, error) + func NewEncoderWithContext(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter) (*Encoder, error) + func (e *Encoder) Encode(val interface{}) error + func (e *Encoder) Reset(vw bsonrw.ValueWriter) error + func (e *Encoder) SetContext(ec bsoncodec.EncodeContext) error + func (e *Encoder) SetRegistry(r *bsoncodec.Registry) error + type M = primitive.M + type Marshaler interface + MarshalBSON func() ([]byte, error) + type PrimitiveCodecs struct + func (PrimitiveCodecs) RawDecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error + func (PrimitiveCodecs) RawEncodeValue(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error + func (PrimitiveCodecs) RawValueDecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error + func (PrimitiveCodecs) RawValueEncodeValue(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error + func (pc PrimitiveCodecs) RegisterPrimitiveCodecs(rb *bsoncodec.RegistryBuilder) + type Raw []byte + func NewFromIOReader(r io.Reader) (Raw, error) + func (r Raw) Elements() ([]RawElement, error) + func (r Raw) Index(index uint) RawElement + func (r Raw) IndexErr(index uint) (RawElement, error) + func (r Raw) Lookup(key ...string) RawValue + func (r Raw) LookupErr(key ...string) (RawValue, error) + func (r Raw) String() string + func (r Raw) Validate() (err error) + func (r Raw) Values() ([]RawValue, error) + type RawElement []byte + func (re RawElement) DebugString() string + func (re RawElement) Key() string + func (re RawElement) KeyErr() (string, error) + func (re RawElement) String() string + func (re RawElement) Validate() error + func (re RawElement) Value() RawValue + func (re RawElement) ValueErr() (RawValue, error) + type RawValue struct + Type bsontype.Type + Value []byte + func (rv RawValue) Array() Raw + func (rv RawValue) ArrayOK() (Raw, bool) + func (rv RawValue) Binary() (subtype byte, data []byte) + func (rv RawValue) BinaryOK() (subtype byte, data []byte, ok bool) + func (rv RawValue) Boolean() bool + func (rv RawValue) BooleanOK() (bool, bool) + func (rv RawValue) CodeWithScope() (string, Raw) + func (rv RawValue) CodeWithScopeOK() (string, Raw, bool) + func (rv RawValue) DBPointer() (string, primitive.ObjectID) + func (rv RawValue) DBPointerOK() (string, primitive.ObjectID, bool) + func (rv RawValue) DateTime() int64 + func (rv RawValue) DateTimeOK() (int64, bool) + func (rv RawValue) DebugString() string + func (rv RawValue) Decimal128() primitive.Decimal128 + func (rv RawValue) Decimal128OK() (primitive.Decimal128, bool) + func (rv RawValue) Document() Raw + func (rv RawValue) DocumentOK() (Raw, bool) + func (rv RawValue) Double() float64 + func (rv RawValue) DoubleOK() (float64, bool) + func (rv RawValue) Equal(rv2 RawValue) bool + func (rv RawValue) Int32() int32 + func (rv RawValue) Int32OK() (int32, bool) + func (rv RawValue) Int64() int64 + func (rv RawValue) Int64OK() (int64, bool) + func (rv RawValue) IsNumber() bool + func (rv RawValue) JavaScript() string + func (rv RawValue) JavaScriptOK() (string, bool) + func (rv RawValue) ObjectID() primitive.ObjectID + func (rv RawValue) ObjectIDOK() (primitive.ObjectID, bool) + func (rv RawValue) Regex() (pattern, options string) + func (rv RawValue) RegexOK() (pattern, options string, ok bool) + func (rv RawValue) String() string + func (rv RawValue) StringValue() string + func (rv RawValue) StringValueOK() (string, bool) + func (rv RawValue) Symbol() string + func (rv RawValue) SymbolOK() (string, bool) + func (rv RawValue) Time() time.Time + func (rv RawValue) TimeOK() (time.Time, bool) + func (rv RawValue) Timestamp() (t, i uint32) + func (rv RawValue) TimestampOK() (t, i uint32, ok bool) + func (rv RawValue) Unmarshal(val interface{}) error + func (rv RawValue) UnmarshalWithContext(dc *bsoncodec.DecodeContext, val interface{}) error + func (rv RawValue) UnmarshalWithRegistry(r *bsoncodec.Registry, val interface{}) error + func (rv RawValue) Validate() error + type Unmarshaler interface + UnmarshalBSON func([]byte) error + type ValueMarshaler interface + MarshalBSONValue func() (bsontype.Type, []byte, error) + type ValueUnmarshaler interface + UnmarshalBSONValue func(bsontype.Type, []byte) error + type Zeroer interface + IsZero func() bool