gnomon

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2016 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

a specialised timestamp to index data collections

consists of:

seconds (int64)    -> the UTC unix time
nano seconds (int) -> fractional time [0 .. 1,000,000,000]

Note that the nano seconds part can be equivalent to 1 second in certain cases to allow for a value that is greater than the current item, but less than or equal to the current item even if the nano seconds was exactly 999,999,999 without having to propagate the carry value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cursor

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

cursor effectively a limited timestamp

This works like erlang:now() and will advance into future if called faster than once per nanosecond continuously.

func NewCursor

func NewCursor() *Cursor

get a current cursor value

ensure that cannot get duplicate value

func (Cursor) Bytes

func (cursor Cursor) Bytes() []byte

convert to byte slice

func (Cursor) MarshalBinary

func (cursor Cursor) MarshalBinary() ([]byte, error)

convert to binary

marshal the value in big-endian order (so database indexing will be in ascending time order)

func (Cursor) MarshalJSON

func (cursor Cursor) MarshalJSON() ([]byte, error)

convert to JSON

func (*Cursor) Next

func (cursor *Cursor) Next()

advance a cursor by one LSB to be the next possible position after the its current value

func (Cursor) String

func (cursor Cursor) String() string

convert to string

func (*Cursor) UnmarshalBinary

func (cursor *Cursor) UnmarshalBinary(s []byte) error

convert from binary

func (*Cursor) UnmarshalJSON

func (cursor *Cursor) UnmarshalJSON(s []byte) error

convert from JSON

Jump to

Keyboard shortcuts

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