types

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinaryGeneric    = BinarySubtype(0x00) // generic
	BinaryFunction   = BinarySubtype(0x01) // function
	BinaryGenericOld = BinarySubtype(0x02) // generic-old
	BinaryUUIDOld    = BinarySubtype(0x03) // uuid-old
	BinaryUUID       = BinarySubtype(0x04) // uuid
	BinaryMD5        = BinarySubtype(0x05) // md5
	BinaryEncrypted  = BinarySubtype(0x06) // encrypted
	BinaryUser       = BinarySubtype(0x80) // user
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array []interface{}

type Binary

type Binary struct {
	Subtype BinarySubtype
	B       []byte
}

type BinarySubtype

type BinarySubtype byte

func (BinarySubtype) String

func (i BinarySubtype) String() string

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document represents BSON document.

Duplicate field names are not supported.

func ConvertDocument

func ConvertDocument(d document) (Document, error)

ConvertDocument converts bson.Document to types.Document and validates it. It references the same data without copying it.

func MakeDocument

func MakeDocument(pairs ...interface{}) (Document, error)

MakeDocument makes a new Document from given key/value pairs.

func MustConvertDocument

func MustConvertDocument(d document) Document

MustConvertDocument is a ConvertDocument that panics in case of error.

func MustMakeDocument

func MustMakeDocument(pairs ...interface{}) Document

MustMakeDocument is a MakeDocument that panics in case of error.

func (Document) Command

func (d Document) Command() string

Command returns the first document's key, this is often used as a command name.

func (Document) Keys

func (d Document) Keys() []string

Keys returns a shallow copy of the document's keys. Do not modify it.

func (Document) Map

func (d Document) Map() map[string]interface{}

Map returns a shallow copy of the document as a map. Do not modify it.

func (*Document) Remove

func (d *Document) Remove(key string)

Remove the given key, doing nothing if the key does not exist.

func (*Document) Set

func (d *Document) Set(key string, value interface{}) error

Set the value of the given key, replacing any existing value.

type ObjectID

type ObjectID [12]byte

type Regex

type Regex struct {
	Pattern string
	Options string
}

type Timestamp

type Timestamp uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL