Versions in this module Expand all Collapse all v2 v2.0.0 Dec 10, 2024 Changes in this version + const MaxDecimal128Exp + const MinDecimal128Exp + const TypeBinaryBinaryOld + const TypeBinaryColumn + const TypeBinaryEncrypted + const TypeBinaryFunction + const TypeBinaryGeneric + const TypeBinaryMD5 + const TypeBinarySensitive + const TypeBinaryUUID + const TypeBinaryUUIDOld + const TypeBinaryUserDefined + var ErrDecodeToNil = errors.New("cannot Decode to nil value") + var ErrEOA = errors.New("end of array") + var ErrEOD = errors.New("end of document") + var ErrInvalidHex = errors.New("the provided hex string is not a valid ObjectID") + var ErrInvalidJSON = errors.New("invalid JSON input") + var ErrMgoSetZero = errors.New("set to zero") + var ErrNilContext = errors.New("DecodeContext cannot be nil") + var ErrNilReader = errors.New("nil reader") + var ErrNilRegistry = errors.New("Registry cannot be nil") + var ErrParseInf = errors.New("cannot parse Infinity as a *big.Int") + var ErrParseNaN = errors.New("cannot parse NaN as a *big.Int") + var ErrParseNegInf = errors.New("cannot parse -Infinity as a *big.Int") + func IndentExtJSON(dst *bytes.Buffer, src []byte, prefix, indent string) error + func Marshal(val interface{}) ([]byte, error) + func MarshalExtJSON(val interface{}, canonical, escapeHTML bool) ([]byte, error) + func MarshalExtJSONIndent(val interface{}, canonical, escapeHTML bool, prefix, indent string) ([]byte, error) + func Unmarshal(data []byte, val interface{}) error + func UnmarshalExtJSON(data []byte, canonicalOnly bool, val interface{}) error + func UnmarshalValue(t Type, data []byte, val interface{}) error + type A []interface + type ArrayReader interface + ReadValue func() (ValueReader, error) + type ArrayWriter interface + WriteArrayElement func() (ValueWriter, error) + WriteArrayEnd func() error + type Binary struct + Data []byte + Subtype byte + func (bp Binary) Equal(bp2 Binary) bool + func (bp Binary) IsZero() bool + type CodeWithScope struct + Code JavaScript + Scope interface{} + func (cws CodeWithScope) String() string + type D []E + func (d *D) UnmarshalJSON(b []byte) error + func (d D) MarshalJSON() ([]byte, error) + func (d D) String() string + type DBPointer struct + DB string + Pointer ObjectID + func (d DBPointer) Equal(d2 DBPointer) bool + func (d DBPointer) IsZero() bool + func (d DBPointer) String() string + type DateTime int64 + func NewDateTimeFromTime(t time.Time) DateTime + func (d *DateTime) UnmarshalJSON(data []byte) error + func (d DateTime) MarshalJSON() ([]byte, error) + func (d DateTime) Time() time.Time + type Decimal128 struct + func NewDecimal128(h, l uint64) Decimal128 + func ParseDecimal128(s string) (Decimal128, error) + func ParseDecimal128FromBigInt(bi *big.Int, exp int) (Decimal128, bool) + func (d *Decimal128) UnmarshalJSON(b []byte) error + func (d Decimal128) BigInt() (*big.Int, int, error) + func (d Decimal128) GetBytes() (uint64, uint64) + func (d Decimal128) IsInf() int + func (d Decimal128) IsNaN() bool + func (d Decimal128) IsZero() bool + func (d Decimal128) MarshalJSON() ([]byte, error) + func (d Decimal128) String() string + type DecodeContext struct + type DecodeError struct + func (de *DecodeError) Error() string + func (de *DecodeError) Keys() []string + func (de *DecodeError) Unwrap() error + type Decoder struct + func NewDecoder(vr ValueReader) *Decoder + func (d *Decoder) AllowTruncatingDoubles() + func (d *Decoder) BinaryAsSlice() + func (d *Decoder) Decode(val interface{}) error + func (d *Decoder) DefaultDocumentM() + func (d *Decoder) ObjectIDAsHexString() + func (d *Decoder) Reset(vr ValueReader) + func (d *Decoder) SetRegistry(r *Registry) + func (d *Decoder) UseJSONStructTags() + func (d *Decoder) UseLocalTimeZone() + func (d *Decoder) ZeroMaps() + func (d *Decoder) ZeroStructs() + type DocumentReader interface + ReadElement func() (string, ValueReader, error) + type DocumentWriter interface + WriteDocumentElement func(string) (ValueWriter, error) + WriteDocumentEnd func() error + type E struct + Key string + Value interface{} + type EncodeContext struct + type Encoder struct + func NewEncoder(vw ValueWriter) *Encoder + func (e *Encoder) Encode(val interface{}) error + func (e *Encoder) ErrorOnInlineDuplicates() + func (e *Encoder) IntMinSize() + func (e *Encoder) NilByteSliceAsEmpty() + func (e *Encoder) NilMapAsEmpty() + func (e *Encoder) NilSliceAsEmpty() + func (e *Encoder) OmitZeroStruct() + func (e *Encoder) Reset(vw ValueWriter) + func (e *Encoder) SetRegistry(r *Registry) + func (e *Encoder) StringifyMapKeysWithFmt() + func (e *Encoder) UseJSONStructTags() + type JavaScript string + type KeyMarshaler interface + MarshalKey func() (key string, err error) + type KeyUnmarshaler interface + UnmarshalKey func(key string) error + type M map[string]interface + func (m M) String() string + type Marshaler interface + MarshalBSON func() ([]byte, error) + type MaxKey struct + type MinKey struct + type Null struct + type ObjectID [12]byte + var NilObjectID ObjectID + func NewObjectID() ObjectID + func NewObjectIDFromTimestamp(timestamp time.Time) ObjectID + func ObjectIDFromHex(s string) (ObjectID, error) + func (id *ObjectID) UnmarshalJSON(b []byte) error + func (id *ObjectID) UnmarshalText(b []byte) error + func (id ObjectID) Hex() string + func (id ObjectID) IsZero() bool + func (id ObjectID) MarshalJSON() ([]byte, error) + func (id ObjectID) MarshalText() ([]byte, error) + func (id ObjectID) String() string + func (id ObjectID) Timestamp() time.Time + type Raw []byte + func ReadDocument(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 RawArray []byte + func ReadArray(r io.Reader) (RawArray, error) + func (a RawArray) DebugString() string + func (a RawArray) Index(index uint) RawValue + func (a RawArray) IndexErr(index uint) (RawValue, error) + func (a RawArray) String() string + func (a RawArray) Validate() error + func (a RawArray) 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 Type + Value []byte + func (rv RawValue) Array() RawArray + func (rv RawValue) ArrayOK() (RawArray, bool) + func (rv RawValue) AsInt64() int64 + func (rv RawValue) AsInt64OK() (int64, 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, ObjectID) + func (rv RawValue) DBPointerOK() (string, ObjectID, bool) + func (rv RawValue) DateTime() int64 + func (rv RawValue) DateTimeOK() (int64, bool) + func (rv RawValue) DebugString() string + func (rv RawValue) Decimal128() Decimal128 + func (rv RawValue) Decimal128OK() (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) IsZero() bool + func (rv RawValue) JavaScript() string + func (rv RawValue) JavaScriptOK() (string, bool) + func (rv RawValue) ObjectID() ObjectID + func (rv RawValue) ObjectIDOK() (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 *DecodeContext, val interface{}) error + func (rv RawValue) UnmarshalWithRegistry(r *Registry, val interface{}) error + func (rv RawValue) Validate() error + type Regex struct + Options string + Pattern string + func (rp Regex) Equal(rp2 Regex) bool + func (rp Regex) IsZero() bool + func (rp Regex) String() string + type Registry struct + func NewMgoRegistry() *Registry + func NewRegistry() *Registry + func NewRespectNilValuesMgoRegistry() *Registry + func (r *Registry) LookupDecoder(valueType reflect.Type) (ValueDecoder, error) + func (r *Registry) LookupEncoder(valueType reflect.Type) (ValueEncoder, error) + func (r *Registry) LookupTypeMapEntry(bt Type) (reflect.Type, error) + func (r *Registry) RegisterInterfaceDecoder(iface reflect.Type, dec ValueDecoder) + func (r *Registry) RegisterInterfaceEncoder(iface reflect.Type, enc ValueEncoder) + func (r *Registry) RegisterKindDecoder(kind reflect.Kind, dec ValueDecoder) + func (r *Registry) RegisterKindEncoder(kind reflect.Kind, enc ValueEncoder) + func (r *Registry) RegisterTypeDecoder(valueType reflect.Type, dec ValueDecoder) + func (r *Registry) RegisterTypeEncoder(valueType reflect.Type, enc ValueEncoder) + func (r *Registry) RegisterTypeMapEntry(bt Type, rt reflect.Type) + type Symbol string + type Timestamp struct + I uint32 + T uint32 + func (tp Timestamp) After(tp2 Timestamp) bool + func (tp Timestamp) Before(tp2 Timestamp) bool + func (tp Timestamp) Compare(tp2 Timestamp) int + func (tp Timestamp) Equal(tp2 Timestamp) bool + func (tp Timestamp) IsZero() bool + type TransitionError struct + func (te TransitionError) Error() string + type Type byte + 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 + func MarshalValue(val interface{}) (Type, []byte, error) + func (bt Type) IsValid() bool + func (bt Type) String() string + type Undefined struct + type Unmarshaler interface + UnmarshalBSON func([]byte) error + type ValueDecoder interface + DecodeValue func(DecodeContext, ValueReader, reflect.Value) error + type ValueDecoderError struct + Kinds []reflect.Kind + Name string + Received reflect.Value + Types []reflect.Type + func (vde ValueDecoderError) Error() string + type ValueDecoderFunc func(DecodeContext, ValueReader, reflect.Value) error + func (fn ValueDecoderFunc) DecodeValue(dc DecodeContext, vr ValueReader, val reflect.Value) error + type ValueEncoder interface + EncodeValue func(EncodeContext, ValueWriter, reflect.Value) error + type ValueEncoderError struct + Kinds []reflect.Kind + Name string + Received reflect.Value + Types []reflect.Type + func (vee ValueEncoderError) Error() string + type ValueEncoderFunc func(EncodeContext, ValueWriter, reflect.Value) error + func (fn ValueEncoderFunc) EncodeValue(ec EncodeContext, vw ValueWriter, val reflect.Value) error + type ValueMarshaler interface + MarshalBSONValue func() (typ byte, data []byte, err error) + type ValueReader interface + ReadArray func() (ArrayReader, error) + ReadBinary func() (b []byte, btype byte, err error) + ReadBoolean func() (bool, error) + ReadCodeWithScope func() (code string, dr DocumentReader, err error) + ReadDBPointer func() (ns string, oid ObjectID, err error) + ReadDateTime func() (int64, error) + ReadDecimal128 func() (Decimal128, error) + ReadDocument func() (DocumentReader, error) + ReadDouble func() (float64, error) + ReadInt32 func() (int32, error) + ReadInt64 func() (int64, error) + ReadJavascript func() (code string, err error) + ReadMaxKey func() error + ReadMinKey func() error + ReadNull func() error + ReadObjectID func() (ObjectID, error) + ReadRegex func() (pattern, options string, err error) + ReadString func() (string, error) + ReadSymbol func() (symbol string, err error) + ReadTimestamp func() (t, i uint32, err error) + ReadUndefined func() error + Skip func() error + Type func() Type + func NewDocumentReader(r io.Reader) ValueReader + func NewExtJSONValueReader(r io.Reader, canonicalOnly bool) (ValueReader, error) + type ValueUnmarshaler interface + UnmarshalBSONValue func(typ byte, data []byte) error + type ValueWriter interface + WriteArray func() (ArrayWriter, error) + WriteBinary func(b []byte) error + WriteBinaryWithSubtype func(b []byte, btype byte) error + WriteBoolean func(bool) error + WriteCodeWithScope func(code string) (DocumentWriter, error) + WriteDBPointer func(ns string, oid ObjectID) error + WriteDateTime func(dt int64) error + WriteDecimal128 func(Decimal128) error + WriteDocument func() (DocumentWriter, error) + WriteDouble func(float64) error + WriteInt32 func(int32) error + WriteInt64 func(int64) error + WriteJavascript func(code string) error + WriteMaxKey func() error + WriteMinKey func() error + WriteNull func() error + WriteObjectID func(ObjectID) error + WriteRegex func(pattern, options string) error + WriteString func(string) error + WriteSymbol func(symbol string) error + WriteTimestamp func(t, i uint32) error + WriteUndefined func() error + func NewDocumentWriter(w io.Writer) ValueWriter + func NewExtJSONValueWriter(w io.Writer, canonical, escapeHTML bool) ValueWriter + type Zeroer interface + IsZero func() bool v2.0.0-beta2 Sep 18, 2024 v2.0.0-beta1 Jul 26, 2024 v2.0.0-alpha2 Jul 26, 2024 Other modules containing this package go.mongodb.org/mongo-driver