id

package
Version: v0.0.0-...-75d2a66 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewObjectId

func NewObjectId() string

func UUID32

func UUID32() string

func UUID36

func UUID36() string

Types

type ObjectId

type ObjectId string

ObjectId is a unique ID identifying a BSON value. It must be exactly 12 bytes long. MongoDB objects by default have such a property set in their "_id" property.

http://www.mongodb.org/display/DOCS/Object+IDs

func ObjectIdHex

func ObjectIdHex(s string) ObjectId

func (ObjectId) Counter

func (id ObjectId) Counter() int32

Counter returns the incrementing value part of the id. It's a runtime error to call this method with an invalid id.

func (ObjectId) Hex

func (id ObjectId) Hex() string

Hex returns a hex representation of the ObjectId.

func (ObjectId) Machine

func (id ObjectId) Machine() []byte

Machine returns the 3-byte machine id part of the id. It's a runtime error to call this method with an invalid id.

func (ObjectId) MarshalJSON

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

MarshalJSON turns a bson.ObjectId into a json.Marshaller.

func (ObjectId) Pid

func (id ObjectId) Pid() uint16

Pid returns the process id part of the id. It's a runtime error to call this method with an invalid id.

func (ObjectId) String

func (id ObjectId) String() string

String returns a hex string representation of the id. Example: ObjectIdHex("4d88e15b60f486e428412dc9").

func (ObjectId) Time

func (id ObjectId) Time() time.Time

Time returns the timestamp part of the id. It's a runtime error to call this method with an invalid id.

func (*ObjectId) UnmarshalJSON

func (id *ObjectId) UnmarshalJSON(data []byte) error

UnmarshalJSON turns *bson.ObjectId into a json.Unmarshaller.

func (ObjectId) Valid

func (id ObjectId) Valid() bool

Valid returns true if id is valid. A valid id must contain exactly 12 bytes.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL