Documentation ¶
Index ¶
- Variables
- func Close(name string)
- func Create(name string) error
- func Drop(name string) error
- func SetTimeout(timeout time.Duration)
- type CoreDS
- type Data
- type Datastore
- func (d *Datastore) Count(iter *Iter) (int, error)
- func (d *Datastore) Delete(key *Key) error
- func (d *Datastore) Get(key *Key) (*json.RawMessage, error)
- func (d *Datastore) Iter(iter *Iter) ([]KeyValue, error)
- func (d *Datastore) Max() (*Key, error)
- func (d *Datastore) Min() (*Key, error)
- func (d *Datastore) Put(data Data) []error
- type Iter
- type Key
- type KeyValue
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("Value not found")
ErrNotFound is the error returned from a core datastore if a value is not found for the passed in key
Functions ¶
func SetTimeout ¶
SetTimeout sets the file timeout (when a datatstore file will auto close)
Types ¶
type CoreDS ¶
CoreDS is a wrapper of the store interface with a few handy things added for managing core datastores used for the operation of a freehold instance
func OpenCoreDS ¶
OpenCoreDS opens a Core datastore
func (*CoreDS) MakeDatastore ¶
MakeDatastore creates a datastore type from the core datastore
type Data ¶
type Data map[string]*json.RawMessage
Data is a generic key / value representation for JSON data the values we dont' acctual decode as it's just stored in the DS as raw JSON bytes anyway
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore holds data and an identifying key in json format in a file on the host
func (*Datastore) Get ¶
func (d *Datastore) Get(key *Key) (*json.RawMessage, error)
Get gets a value out of a datastore
type Iter ¶
type Iter struct { From *Key `json:"from,omitempty"` To *Key `json:"to,omitempty"` Skip int `json:"skip,omitempty"` Limit int `json:"limit,omitempty"` Regexp string `json:"regexp,omitempty"` Order string `json:"order,omitempty"` }
Iter is the json view of an iterator
type Key ¶
type Key json.RawMessage
Key is type that tries to save keys in proper byte order if they are numbers, so they remain sortable It does this by testing whether or not the incoming key is a number if it is, then it'll pack the encoded value with big endian encoded float value at the lead for sorting for decoding it simply throws away that extra info
func (*Key) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*Key) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type KeyValue ¶
type KeyValue struct { Key *Key `json:"key,omitempty"` Value *json.RawMessage `json:"value,omitempty"` }
KeyValue is a JSON representation of a key value