elastigo

package
v0.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2016 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalInstance string

Currently, elastigo does not allow connecting to multiple elasticsearch instances. The elastigo API uses global static variables (ugh). See https://github.com/mattbaird/elastigo/issues/22

Thus, we use a global static variable (GlobalInstance), and return an error if NewDatastore is called twice with different addresses.

Functions

func BlakeKeyHash

func BlakeKeyHash(key ds.Key) string

Hash a key and return the first 16 hex chars of its blake2b hash. basically: Blake2b(key).HexString[:16]

Types

type Datastore

type Datastore struct {

	// Elastic search does not allow slashes in their object ids,
	// so we hash the key. By default, we use the provided BlakeKeyHash
	KeyHash func(ds.Key) string
	// contains filtered or unexported fields
}

Datastore uses a standard Go map for internal storage.

func NewDatastore

func NewDatastore(urlstr string) (*Datastore, error)

func (*Datastore) Delete

func (d *Datastore) Delete(key ds.Key) (err error)

func (*Datastore) Get

func (d *Datastore) Get(key ds.Key) (value interface{}, err error)

func (*Datastore) Has

func (d *Datastore) Has(key ds.Key) (exists bool, err error)

func (*Datastore) Index

func (d *Datastore) Index(key ds.Key) string

Returns the ElasticSearch index for given key. If the datastore specifies an index, use that. Else, key.Parent

func (*Datastore) Put

func (d *Datastore) Put(key ds.Key, value interface{}) (err error)

value should be JSON serializable.

func (*Datastore) Query

func (d *Datastore) Query(query.Query) (query.Results, error)

Jump to

Keyboard shortcuts

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