Documentation
¶
Index ¶
- func AppendBooleanElement(dst []byte, key string, value bool) []byte
- func AppendCString(dst []byte, value string) []byte
- func AppendDateTimeElement(dst []byte, key string, value int64) []byte
- func AppendDocumentElement(dst []byte, key string, value Document) []byte
- func AppendDoubleElement(dst []byte, key string, value float64) []byte
- func AppendInt32(dst []byte, value int32) []byte
- func AppendInt32Element(dst []byte, key string, value int32) []byte
- func AppendInt64Element(dst []byte, key string, value int64) []byte
- func AppendInterfaceElement(dst []byte, key string, ivalue interface{}) ([]byte, error)
- func AppendNullElement(dst []byte, key string) []byte
- func AppendStringElement(dst []byte, key string, value string) []byte
- func AppendValueElement(dst []byte, key string, value Value) ([]byte, error)
- func EndDocument(dst []byte) ([]byte, error)
- type Datetime
- type Dictionary
- func (dict *Dictionary) BSONBytes() (Document, error)
- func (dict *Dictionary) SetBooleanElement(key string, element bool)
- func (dict *Dictionary) SetDatetimeElement(key string, element Datetime)
- func (dict *Dictionary) SetDocumentElement(key string, element Document)
- func (dict *Dictionary) SetDoubleElement(key string, element float64)
- func (dict *Dictionary) SetElements(elements map[string]interface{}) error
- func (dict *Dictionary) SetInt32ArrayElements(key string, elements []int32)
- func (dict *Dictionary) SetInt32Element(key string, element int32)
- func (dict *Dictionary) SetInt64Element(key string, element int64)
- func (dict *Dictionary) SetNullElement(key string)
- func (dict *Dictionary) SetStringElement(key string, element string)
- type Document
- type Element
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBooleanElement ¶
AppendBooleanElement appends a boolean element to dst and return the extended buffer.
func AppendCString ¶
AppendCString appends a string as a cstring to dst and return the extended buffer.
func AppendDateTimeElement ¶
AppendDateTimeElement appends an i64 datetime to dst and return the extended buffer.
func AppendDocumentElement ¶
AppendDocumentElement appends a document to dst and return the extended buffer.
func AppendDoubleElement ¶
AppendDoubleElement appends a float64 element to dst and return the extended buffer.
func AppendInt32 ¶
AppendInt32 appends an i32 value to dst and return the extended buffer.
func AppendInt32Element ¶
AppendInt32Element appends an i32 element to dst and return the extended buffer.
func AppendInt64Element ¶
AppendInt64Element appends an i64 element to dst and return the extended buffer.
func AppendInterfaceElement ¶
AppendInterfaceElement will append an interface element using key to dst and return the extended buffer.
func AppendNullElement ¶
AppendNullElement will append a BSON null element using key to dst and return the extended buffer.
func AppendStringElement ¶
AppendStringElement appends a string element to dst and return the extended buffer.
func AppendValueElement ¶
AppendValueElement will append a value using key to dst and return the extended buffer.
func EndDocument ¶
EndDocument writes the null byte for a document and updates the length of the document.
Types ¶
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary represents a simple BSON document.
func NewDictionary ¶
func NewDictionary() *Dictionary
NewDictionary returns a new dictionary instance.
func (*Dictionary) BSONBytes ¶
func (dict *Dictionary) BSONBytes() (Document, error)
See : BSON Specification Version 1.1 http://bsonspec.org/spec.html BSONBytes returns a BSON document of the dictionary.
func (*Dictionary) SetBooleanElement ¶
func (dict *Dictionary) SetBooleanElement(key string, element bool)
SetBooleanElement sets a boolean element.
func (*Dictionary) SetDatetimeElement ¶
func (dict *Dictionary) SetDatetimeElement(key string, element Datetime)
SetDatetimeElement sets a datetime element.
func (*Dictionary) SetDocumentElement ¶
func (dict *Dictionary) SetDocumentElement(key string, element Document)
SetDocumentElement sets a document element.
func (*Dictionary) SetDoubleElement ¶
func (dict *Dictionary) SetDoubleElement(key string, element float64)
SetDoubleElement sets a int64 element.
func (*Dictionary) SetElements ¶
func (dict *Dictionary) SetElements(elements map[string]interface{}) error
SetElements sets elements.
func (*Dictionary) SetInt32ArrayElements ¶
func (dict *Dictionary) SetInt32ArrayElements(key string, elements []int32)
SetInt32ArrayElements sets an interger array element.
func (*Dictionary) SetInt32Element ¶
func (dict *Dictionary) SetInt32Element(key string, element int32)
SetInt32Element sets a int32 element.
func (*Dictionary) SetInt64Element ¶
func (dict *Dictionary) SetInt64Element(key string, element int64)
SetInt64Element sets a int64 element.
func (*Dictionary) SetNullElement ¶
func (dict *Dictionary) SetNullElement(key string)
SetNullElement sets a null element.
func (*Dictionary) SetStringElement ¶
func (dict *Dictionary) SetStringElement(key string, element string)
SetStringElement sets a string element.
type Document ¶
Document represents a document of MongoDB wire protocol.
func NewDocumentWithBytes ¶
NewDocumentWithBytes returns a document with the specified bytes.
func StartDocument ¶
func StartDocument() Document
StartDocument returns a new document which has only the reserved length header.