types

package
v0.0.0-...-d5f3c33 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHex = errors.New("the provided hex string is not a valid ObjectID")

ErrInvalidHex indicates that a hex string cannot be converted to an ObjectID.

View Source
var MaxKey struct{}

MaxKey represents the BSON minkey value.

View Source
var MinKey struct{}

MinKey represents the BSON maxkey value.

View Source
var Null struct{}

Null represents the BSON null value.

View Source
var Undefined struct{}

Undefined represents the BSON undefined value.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	Subtype byte
	Data    []byte
}

Binary represents a BSON binary value.

type CodeWithScope

type CodeWithScope struct {
	Code  string
	Scope []byte
}

CodeWithScope represents a BSON JavaScript code with scope value.

func (CodeWithScope) String

func (cws CodeWithScope) String() string

type DBPointer

type DBPointer struct {
	DB      string
	Pointer ObjectID
}

DBPointer represents a BSON dbpointer value.

func (DBPointer) String

func (d DBPointer) String() string

type DateTime

type DateTime int64

DateTime represents the BSON datetime value.

type JavaScriptCode

type JavaScriptCode string

JavaScriptCode represents a BSON JavaScript code value.

type ObjectID

type ObjectID [12]byte

ObjectID is the BSON ObjectID type.

var NilObjectID ObjectID

NilObjectID is the zero value for ObjectID.

func FromHex

func FromHex(s string) (ObjectID, error)

FromHex creates a new ObjectID from a hex string. It returns an error if the hex string is not a valid ObjectID.

func NewObjectID

func NewObjectID() ObjectID

New generates a new ObjectID.

func (ObjectID) Hex

func (id ObjectID) Hex() string

Hex returns the hex encoding of the ObjectID as a string.

func (ObjectID) IsZero

func (id ObjectID) IsZero() bool

IsZero returns true if id is the empty ObjectID.

func (ObjectID) MarshalJSON

func (id ObjectID) MarshalJSON() ([]byte, error)

MarshalJSON returns the ObjectID as a string

func (ObjectID) String

func (id ObjectID) String() string

func (*ObjectID) UnmarshalJSON

func (id *ObjectID) UnmarshalJSON(b []byte) error

UnmarshalJSON populates the byte slice with the ObjectID. If the byte slice is 64 bytes long, it will be populated with the hex representation of the ObjectID. If the byte slice is twelve bytes long, it will be populated with the BSON representation of the ObjectID. Otherwise, it will return an error.

type Regex

type Regex struct {
	Pattern string
	Options string
}

Regex represents a BSON regex value.

func (Regex) String

func (r Regex) String() string

type Symbol

type Symbol string

Symbol represents a BSON symbol value.

type Timestamp

type Timestamp struct {
	T uint32
	I uint32
}

Timestamp represents a BSON timestamp value.

Jump to

Keyboard shortcuts

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