# Packages
Package mgocompat provides Registry, a BSON registry compatible with globalsign/mgo's BSON, with some remaining differences.
# Functions
IndentExtJSON will prefix and indent the provided extended JSON src and append it to dst.
Marshal returns the BSON encoding of val as a BSON document.
MarshalExtJSON returns the extended JSON encoding of val.
MarshalExtJSONIndent returns the extended JSON encoding of val with each line with prefixed and indented.
MarshalValue returns the BSON encoding of val.
NewDateTimeFromTime creates a new DateTime from a Time.
NewDecimal128 creates a Decimal128 using the provide high and low uint64s.
NewDecoder returns a new decoder that reads from vr.
NewDocumentReader returns a ValueReader using b for the underlying BSON representation.
NewDocumentWriter creates a ValueWriter that writes BSON to w.
NewEncoder returns a new encoder that writes to vw.
NewExtJSONValueReader returns a ValueReader that reads Extended JSON values from r.
NewExtJSONValueWriter creates a ValueWriter that writes Extended JSON to w.
NewMgoRegistry creates a new bson.Registry configured with the default encoders and decoders.
NewObjectID generates a new ObjectID.
NewObjectIDFromTimestamp generates a new ObjectID based on the given time.
NewPackedBitVector constructs a Vector from a byte slice and a value of byte padding.
NewRegistry creates a new empty Registry.
NewRespectNilValuesMgoRegistry creates a new bson.Registry configured to behave like mgo/bson with RespectNilValues set to true.
NewVector constructs a Vector from a slice of int8 or float32.
NewVectorFromBinary unpacks a BSON Binary into a Vector.
ObjectIDFromHex creates a new ObjectID from a hex string.
ParseDecimal128 takes the given string and attempts to parse it into a valid Decimal128 value.
ParseDecimal128FromBigInt attempts to parse the given significand and exponent into a valid Decimal128 value.
ReadArray reads a BSON array from the io.Reader and returns it as a bson.RawArray.
ReadDocument reads a BSON document from the io.Reader and returns it as a bson.Raw.
Unmarshal parses the BSON-encoded data and stores the result in the value pointed to by val.
UnmarshalExtJSON parses the extended JSON-encoded data and stores the result in the value pointed to by val.
UnmarshalValue parses the BSON value of type t with bson.NewRegistry() and stores the result in the value pointed to by val.
# Constants
BSON binary vector types as described in https://bsonspec.org/spec.html.
BSON binary vector types as described in https://bsonspec.org/spec.html.
These constants are the maximum and minimum values for the exponent field in a decimal128 value.
These constants are the maximum and minimum values for the exponent field in a decimal128 value.
BSON binary vector types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON binary element subtypes as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
BSON element types as described in https://bsonspec.org/spec.html.
# Variables
ErrDecodeToNil is the error returned when trying to decode to a nil value.
ErrEOA is the error returned when the end of a BSON array has been reached.
ErrEOD is the error returned when the end of a BSON document has been reached.
ErrInvalidHex indicates that a hex string cannot be converted to an ObjectID.
ErrInvalidJSON indicates the JSON input is invalid.
ErrMgoSetZero may be returned from a SetBSON method to have the value set to its respective zero value.
ErrNilContext is returned when the provided DecodeContext is nil.
ErrNilReader indicates that an operation was attempted on a nil bson.Reader.
ErrNilRegistry is returned when the provided registry is nil.
These errors are returned when an invalid value is parsed as a big.Int.
These errors are returned when an invalid value is parsed as a big.Int.
These errors are returned when an invalid value is parsed as a big.Int.
NilObjectID is the zero value for ObjectID.
# Structs
Binary represents a BSON binary value.
CodeWithScope represents a BSON JavaScript code with scope value.
DBPointer represents a BSON dbpointer value.
Decimal128 holds decimal128 BSON values.
DecodeContext is the contextual information required for a Codec to decode a value.
DecodeError represents an error that occurs when unmarshalling BSON bytes into a native Go type.
A Decoder reads and decodes BSON documents from a stream.
E represents a BSON element for a D.
EncodeContext is the contextual information required for a Codec to encode a value.
An Encoder writes a serialization format to an output stream.
MaxKey represents the BSON maxkey value.
MinKey represents the BSON minkey value.
Null represents the BSON null value.
RawValue is a raw encoded BSON value.
Regex represents a BSON regex value.
A Registry is a store for ValueEncoders, ValueDecoders, and a type map.
Timestamp represents a BSON timestamp value.
TransitionError is an error returned when an invalid progressing a ValueReader or ValueWriter state machine occurs.
Undefined represents the BSON undefined value type.
ValueDecoderError is an error returned from a ValueDecoder when the provided value can't be decoded by the ValueDecoder.
ValueEncoderError is an error returned from a ValueEncoder when the provided value can't be encoded by the ValueEncoder.
Vector represents a densely packed array of numbers / bits.
# Interfaces
ArrayReader is implemented by types that allow reading values from a BSON array.
ArrayWriter is the interface used to create a BSON or BSON adjacent array.
DocumentReader is implemented by types that allow reading elements from a BSON document.
DocumentWriter is the interface used to create a BSON or BSON adjacent document.
KeyMarshaler is the interface implemented by an object that can marshal itself into a string key.
KeyUnmarshaler is the interface implemented by an object that can unmarshal a string representation of itself.
Marshaler is the interface implemented by types that can marshal themselves into a valid BSON document.
Unmarshaler is the interface implemented by types that can unmarshal a BSON document representation of themselves.
ValueDecoder is the interface implemented by types that can decode BSON to a provided Go type.
ValueEncoder is the interface implemented by types that can encode a provided Go type to BSON.
ValueMarshaler is the interface implemented by types that can marshal themselves into a valid BSON value.
ValueReader is a generic interface used to read values from BSON.
ValueUnmarshaler is the interface implemented by types that can unmarshal a BSON value representation of themselves.
ValueWriter is the interface used to write BSON values.
Zeroer allows custom struct types to implement a report of zero state.
# Type aliases
An A is an ordered representation of a BSON array.
D is an ordered representation of a BSON document.
DateTime represents the BSON datetime value.
JavaScript represents a BSON JavaScript code value.
M is an unordered representation of a BSON document.
ObjectID is the BSON ObjectID type.
Raw is a raw encoded BSON document.
RawArray is a raw bytes representation of a BSON array.
RawElement is a raw encoded BSON document or array element.
Symbol represents a BSON symbol value.
Type represents a BSON type.
ValueDecoderFunc is an adapter function that allows a function with the correct signature to be used as a ValueDecoder.
ValueEncoderFunc is an adapter function that allows a function with the correct signature to be used as a ValueEncoder.