Versions in this module Expand all Collapse all v1 v1.4.1 Sep 27, 2020 Changes in this version + const EmptyDocumentLength + var BuildDocumentFromElements = BuildDocument + var ErrCorruptedDocument = errors.New("invalid DocumentSequence: corrupted document") + var ErrElementNotFound = errors.New("element not found") + var ErrEmptyKey = errors.New("empty key provided") + var ErrInvalidDocumentSequenceStyle = errors.New("invalid DocumentSequenceStyle") + var ErrInvalidLength = errors.New("document length is invalid") + var ErrNilReader = errors.New("nil reader") + var ErrNonDocument = errors.New("invalid DocumentSequence: a non-document value was found in sequence") + var ErrOutOfBounds = errors.New("out of bounds") + func AppendArray(dst []byte, arr []byte) []byte + func AppendArrayElement(dst []byte, key string, arr []byte) []byte + func AppendArrayElementStart(dst []byte, key string) (index int32, b []byte) + func AppendArrayEnd(dst []byte, index int32) ([]byte, error) + func AppendArrayStart(dst []byte) (index int32, b []byte) + func AppendBinary(dst []byte, subtype byte, b []byte) []byte + func AppendBinaryElement(dst []byte, key string, subtype byte, b []byte) []byte + func AppendBoolean(dst []byte, b bool) []byte + func AppendBooleanElement(dst []byte, key string, b bool) []byte + func AppendCodeWithScope(dst []byte, code string, scope []byte) []byte + func AppendCodeWithScopeElement(dst []byte, key, code string, scope []byte) []byte + func AppendDBPointer(dst []byte, ns string, oid primitive.ObjectID) []byte + func AppendDBPointerElement(dst []byte, key, ns string, oid primitive.ObjectID) []byte + func AppendDateTime(dst []byte, dt int64) []byte + func AppendDateTimeElement(dst []byte, key string, dt int64) []byte + func AppendDecimal128(dst []byte, d128 primitive.Decimal128) []byte + func AppendDecimal128Element(dst []byte, key string, d128 primitive.Decimal128) []byte + func AppendDocument(dst []byte, doc []byte) []byte + func AppendDocumentElement(dst []byte, key string, doc []byte) []byte + func AppendDocumentElementStart(dst []byte, key string) (index int32, b []byte) + func AppendDocumentEnd(dst []byte, index int32) ([]byte, error) + func AppendDocumentStart(dst []byte) (index int32, b []byte) + func AppendDocumentStartInline(dst []byte, index *int32) []byte + func AppendDouble(dst []byte, f float64) []byte + func AppendDoubleElement(dst []byte, key string, f float64) []byte + func AppendHeader(dst []byte, t bsontype.Type, key string) []byte + func AppendInt32(dst []byte, i32 int32) []byte + func AppendInt32Element(dst []byte, key string, i32 int32) []byte + func AppendInt64(dst []byte, i64 int64) []byte + func AppendInt64Element(dst []byte, key string, i64 int64) []byte + func AppendJavaScript(dst []byte, js string) []byte + func AppendJavaScriptElement(dst []byte, key, js string) []byte + func AppendKey(dst []byte, key string) []byte + func AppendMaxKeyElement(dst []byte, key string) []byte + func AppendMinKeyElement(dst []byte, key string) []byte + func AppendNullElement(dst []byte, key string) []byte + func AppendObjectID(dst []byte, oid primitive.ObjectID) []byte + func AppendObjectIDElement(dst []byte, key string, oid primitive.ObjectID) []byte + func AppendRegex(dst []byte, pattern, options string) []byte + func AppendRegexElement(dst []byte, key, pattern, options string) []byte + func AppendString(dst []byte, s string) []byte + func AppendStringElement(dst []byte, key, val string) []byte + func AppendSymbol(dst []byte, symbol string) []byte + func AppendSymbolElement(dst []byte, key, symbol string) []byte + func AppendTime(dst []byte, t time.Time) []byte + func AppendTimeElement(dst []byte, key string, t time.Time) []byte + func AppendTimestamp(dst []byte, t, i uint32) []byte + func AppendTimestampElement(dst []byte, key string, t, i uint32) []byte + func AppendType(dst []byte, t bsontype.Type) []byte + func AppendUndefinedElement(dst []byte, key string) []byte + func AppendValueElement(dst []byte, key string, value Value) []byte + func BuildArray(dst []byte, values ...Value) []byte + func BuildArrayElement(dst []byte, key string, values ...Value) []byte + func BuildDocument(dst []byte, elems ...[]byte) []byte + func BuildDocumentElement(dst []byte, key string, elems ...[]byte) []byte + func EqualValue(t1, t2 bsontype.Type, v1, v2 []byte) bool + func NewDocumentLengthError(length, rem int) error + func ReadBinary(src []byte) (subtype byte, bin []byte, rem []byte, ok bool) + func ReadBoolean(src []byte) (bool, []byte, bool) + func ReadCodeWithScope(src []byte) (code string, scope []byte, rem []byte, ok bool) + func ReadDBPointer(src []byte) (ns string, oid primitive.ObjectID, rem []byte, ok bool) + func ReadDateTime(src []byte) (int64, []byte, bool) + func ReadDecimal128(src []byte) (primitive.Decimal128, []byte, bool) + func ReadDouble(src []byte) (float64, []byte, bool) + func ReadHeader(src []byte) (t bsontype.Type, key string, rem []byte, ok bool) + func ReadHeaderBytes(src []byte) (header []byte, rem []byte, ok bool) + func ReadInt32(src []byte) (int32, []byte, bool) + func ReadInt64(src []byte) (int64, []byte, bool) + func ReadJavaScript(src []byte) (js string, rem []byte, ok bool) + func ReadKey(src []byte) (string, []byte, bool) + func ReadKeyBytes(src []byte) ([]byte, []byte, bool) + func ReadLength(src []byte) (int32, []byte, bool) + func ReadObjectID(src []byte) (primitive.ObjectID, []byte, bool) + func ReadRegex(src []byte) (pattern, options string, rem []byte, ok bool) + func ReadString(src []byte) (string, []byte, bool) + func ReadSymbol(src []byte) (symbol string, rem []byte, ok bool) + func ReadTime(src []byte) (time.Time, []byte, bool) + func ReadTimestamp(src []byte) (t, i uint32, rem []byte, ok bool) + func ReadType(src []byte) (bsontype.Type, []byte, bool) + func ReserveLength(dst []byte) (int32, []byte) + func UpdateLength(dst []byte, index, length int32) []byte + type Array = Document + type Document []byte + func NewDocumentFromReader(r io.Reader) (Document, error) + func ReadArray(src []byte) (arr Document, rem []byte, ok bool) + func ReadDocument(src []byte) (doc Document, rem []byte, ok bool) + func (d Document) DebugString() string + func (d Document) Elements() ([]Element, error) + func (d Document) Index(index uint) Element + func (d Document) IndexErr(index uint) (Element, error) + func (d Document) Lookup(key ...string) Value + func (d Document) LookupErr(key ...string) (Value, error) + func (d Document) String() string + func (d Document) Validate() error + func (d Document) Values() ([]Value, error) + type DocumentSequence struct + Data []byte + Pos int + Style DocumentSequenceStyle + func (ds *DocumentSequence) DocumentCount() int + func (ds *DocumentSequence) Documents() ([]Document, error) + func (ds *DocumentSequence) Empty() bool + func (ds *DocumentSequence) Next() (Document, error) + func (ds *DocumentSequence) ResetIterator() + type DocumentSequenceStyle uint32 + const ArrayStyle + const SequenceStyle + type DocumentValidationError string + const ErrMissingNull + func (dve DocumentValidationError) Error() string + type Element []byte + func ReadElement(src []byte) (Element, []byte, bool) + func (e Element) CompareKey(key []byte) bool + func (e Element) DebugString() string + func (e Element) Key() string + func (e Element) KeyBytes() []byte + func (e Element) KeyBytesErr() ([]byte, error) + func (e Element) KeyErr() (string, error) + func (e Element) String() string + func (e Element) Validate() error + func (e Element) Value() Value + func (e Element) ValueErr() (Value, error) + type ElementTypeError struct + Method string + Type bsontype.Type + func (ete ElementTypeError) Error() string + type InsufficientBytesError struct + Remaining []byte + Source []byte + Stack stack.CallStack + func NewInsufficientBytesError(src, rem []byte) InsufficientBytesError + func (ibe InsufficientBytesError) Equal(err2 error) bool + func (ibe InsufficientBytesError) Error() string + func (ibe InsufficientBytesError) ErrorStack() string + type InvalidDepthTraversalError struct + Key string + Type bsontype.Type + func (idte InvalidDepthTraversalError) Error() string + type MalformedElementError string + const ErrElementMissingKey + const ErrElementMissingType + func (mee MalformedElementError) Error() string + type Value struct + Data []byte + Type bsontype.Type + func BuildDocumentValue(elems ...[]byte) Value + func ReadValue(src []byte, t bsontype.Type) (Value, []byte, bool) + func (v *Value) Add(v2 Value) error + func (v Value) Array() Document + func (v Value) ArrayOK() (Document, bool) + func (v Value) AsFloat64() float64 + func (v Value) AsFloat64OK() (float64, bool) + func (v Value) AsInt32() int32 + func (v Value) AsInt32OK() (int32, bool) + func (v Value) AsInt64() int64 + func (v Value) AsInt64OK() (int64, bool) + func (v Value) Binary() (subtype byte, data []byte) + func (v Value) BinaryOK() (subtype byte, data []byte, ok bool) + func (v Value) Boolean() bool + func (v Value) BooleanOK() (bool, bool) + func (v Value) CodeWithScope() (string, Document) + func (v Value) CodeWithScopeOK() (string, Document, bool) + func (v Value) DBPointer() (string, primitive.ObjectID) + func (v Value) DBPointerOK() (string, primitive.ObjectID, bool) + func (v Value) DateTime() int64 + func (v Value) DateTimeOK() (int64, bool) + func (v Value) DebugString() string + func (v Value) Decimal128() primitive.Decimal128 + func (v Value) Decimal128OK() (primitive.Decimal128, bool) + func (v Value) Document() Document + func (v Value) DocumentOK() (Document, bool) + func (v Value) Double() float64 + func (v Value) DoubleOK() (float64, bool) + func (v Value) Equal(v2 Value) bool + func (v Value) Int32() int32 + func (v Value) Int32OK() (int32, bool) + func (v Value) Int64() int64 + func (v Value) Int64OK() (int64, bool) + func (v Value) IsNumber() bool + func (v Value) JavaScript() string + func (v Value) JavaScriptOK() (string, bool) + func (v Value) ObjectID() primitive.ObjectID + func (v Value) ObjectIDOK() (primitive.ObjectID, bool) + func (v Value) Regex() (pattern, options string) + func (v Value) RegexOK() (pattern, options string, ok bool) + func (v Value) String() string + func (v Value) StringValue() string + func (v Value) StringValueOK() (string, bool) + func (v Value) Symbol() string + func (v Value) SymbolOK() (string, bool) + func (v Value) Time() time.Time + func (v Value) TimeOK() (time.Time, bool) + func (v Value) Timestamp() (t, i uint32) + func (v Value) TimestampOK() (t, i uint32, ok bool) + func (v Value) Validate() error