Documentation ¶
Overview ¶
A client for use with Orchestrate.io: http://orchestrate.io/
Orchestrate unifies multiple databases through one simple REST API. Orchestrate runs as a service and supports queries like full-text search, events, graph, and key/value.
You can sign up for an Orchestrate account here: http://dashboard.orchestrate.io
Index ¶
- Variables
- type Client
- func (c *Client) Delete(collection, key string) error
- func (c *Client) DeleteCollection(collection string) error
- func (c *Client) DeleteIfUnmodified(path *Path) error
- func (c *Client) DeleteRelation(sourceCollection string, sourceKey string, kind string, sinkCollection string, ...) error
- func (c *Client) Get(collection, key string) (*KVResult, error)
- func (c *Client) GetEvents(collection, key, kind string) (*EventResults, error)
- func (c *Client) GetEventsInRange(collection, key, kind string, start int64, end int64) (*EventResults, error)
- func (c *Client) GetEventsInRangeWithLimit(collection, key, kind string, start, end, limit int64) (*EventResults, error)
- func (c *Client) GetPath(path *Path) (*KVResult, error)
- func (c *Client) GetRef(collection, key, ref string) (*KVResult, error)
- func (c *Client) GetRelations(collection, key string, hops []string) (*GraphResults, error)
- func (c *Client) List(collection string, limit int) (*KVResults, error)
- func (c *Client) ListAfter(collection, after string, limit int) (*KVResults, error)
- func (c *Client) ListGetNext(results *KVResults) (*KVResults, error)
- func (c *Client) ListRange(collection, start, end string, limit int) (*KVResults, error)
- func (c *Client) ListRefs(collection, key string, limit int, values bool) (*RefResults, error)
- func (c *Client) ListRefsFromOffset(collection, key string, limit int, values bool, offset int) (*RefResults, error)
- func (c *Client) ListRefsGetNext(results *RefResults) (*RefResults, error)
- func (c *Client) ListStart(collection, start string, limit int) (*KVResults, error)
- func (c *Client) Ping() error
- func (c *Client) Purge(collection, key string) error
- func (c *Client) Put(collection string, key string, value interface{}) (*Path, error)
- func (c *Client) PutEvent(collection, key, kind string, value interface{}) error
- func (c *Client) PutEventRaw(collection, key, kind string, value io.Reader) error
- func (c *Client) PutEventWithTime(collection, key, kind string, time int64, value interface{}) error
- func (c *Client) PutEventWithTimeRaw(collection, key, kind string, time int64, value io.Reader) error
- func (c *Client) PutIfAbsent(collection, key string, value interface{}) (*Path, error)
- func (c *Client) PutIfAbsentRaw(collection, key string, value io.Reader) (*Path, error)
- func (c *Client) PutIfUnmodified(path *Path, value interface{}) (*Path, error)
- func (c *Client) PutIfUnmodifiedRaw(path *Path, value io.Reader) (*Path, error)
- func (c *Client) PutRaw(collection string, key string, value io.Reader) (*Path, error)
- func (c *Client) PutRelation(sourceCollection, sourceKey, kind, sinkCollection, sinkKey string) error
- func (c *Client) Search(collection, query string, limit, offset int) (*SearchResults, error)
- func (c *Client) SearchGetNext(results *SearchResults) (*SearchResults, error)
- func (c *Client) SearchGetPrev(results *SearchResults) (*SearchResults, error)
- func (c *Client) SearchSorted(collection, query, sortBy string, limit, offset int) (*SearchResults, error)
- type Event
- type EventResults
- type GraphResult
- type GraphResults
- type KVResult
- type KVResults
- type OrchestrateError
- type Path
- type RefResult
- type RefResults
- type SearchResult
- type SearchResults
Constants ¶
This section is empty.
Variables ¶
var ( // This is the default hostname that will be queried for API calls. DefaultAPIHost = "api.orchestrate.io" // The default timeout that will be used for connections. This is used // with the default Transport to establish how long a connection attempt // can take. This is not the data transfer timeout. Changing this will // impact all new connections made with the default transport. DefaultDialTimeout = 3 * time.Second // This is the default http.Transport that will be associated with new // clients. If overwritten then only new clients will be impacted, old // clients will continue to use the pre-existing transport. DefaultTransport *http.Transport = &http.Transport{ MaxIdleConnsPerHost: 4, ResponseHeaderTimeout: 3 * time.Second, Dial: func(network, addr string) (net.Conn, error) { return net.DialTimeout(network, addr, DefaultDialTimeout) }, } )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // This is the host name that will be used in client queries. By default // this will be set to DefaultAPIHost, and if this is left empty // then that default will be used as well. APIHost string // This is the HTTP client that will be used to perform HTTP queries // against Orchestrate. HTTPClient *http.Client // contains filtered or unexported fields }
An Orchestrate Client object.
func NewClient ¶
Returns a new Client object that will use the given authToken for authorization against Orchestrate. This token can be obtained at http://dashboard.orchestrate.io
func NewClientWithTransport ¶
func NewClientWithTransport( deprecated_authToken string, deprecated_transport *http.Transport, ) *Client
This function is deprecated. Please just set the HTTPClient field on the client object manually.
func (*Client) DeleteCollection ¶
Delete a collection.
func (*Client) DeleteIfUnmodified ¶
Delete the value held at a collection-key par if the path's ref value is the latest.
func (*Client) DeleteRelation ¶
func (c *Client) DeleteRelation(sourceCollection string, sourceKey string, kind string, sinkCollection string, sinkKey string) error
Create a relationship of a specified type between two collection-keys.
func (*Client) GetEvents ¶
func (c *Client) GetEvents(collection, key, kind string) (*EventResults, error)
Get latest events of a particular type from specified collection-key pair.
func (*Client) GetEventsInRange ¶
func (c *Client) GetEventsInRange(collection, key, kind string, start int64, end int64) (*EventResults, error)
Get all events of a particular type from specified collection-key pair in a range.
func (*Client) GetEventsInRangeWithLimit ¶
func (c *Client) GetEventsInRangeWithLimit(collection, key, kind string, start, end, limit int64) (*EventResults, error)
Get all events of a particular type from a specified collection-key in a range with a limit
func (*Client) GetRelations ¶
func (c *Client) GetRelations(collection, key string, hops []string) (*GraphResults, error)
Get all related key/value objects by collection-key and a list of relations.
func (*Client) ListAfter ¶
List the values in a collection in key order with the specified page size that come after the specified key.
func (*Client) ListGetNext ¶
Get the page of key/value list results that follow that provided set.
func (*Client) ListRange ¶
List the values in a collection within a given range of keys, starting with the specified key and stopping at the end key
func (*Client) ListRefs ¶
List the refs of a value in time order with the specified page size optionally retrieving values.
func (*Client) ListRefsFromOffset ¶
func (c *Client) ListRefsFromOffset(collection, key string, limit int, values bool, offset int) (*RefResults, error)
List the refs of a value in time order with the specified page size optionally retrieving values starting at the specified offset.
func (*Client) ListRefsGetNext ¶
func (c *Client) ListRefsGetNext(results *RefResults) (*RefResults, error)
Get the page of ref list results that follow the provided set.
func (*Client) ListStart ¶
List the values in a collection in key order with the specified page size starting with the specified key.
func (*Client) PutEventRaw ¶
Put an event of the specified type to provided collection-key pair.
func (*Client) PutEventWithTime ¶
func (c *Client) PutEventWithTime(collection, key, kind string, time int64, value interface{}) error
Put an event of the specified type to provided collection-key pair and time.
func (*Client) PutEventWithTimeRaw ¶
func (c *Client) PutEventWithTimeRaw(collection, key, kind string, time int64, value io.Reader) error
Put an event of the specified type to provided collection-key pair and time.
func (*Client) PutIfAbsent ¶
Store a value to a collection-key pair if it doesn't already hold a value.
func (*Client) PutIfAbsentRaw ¶
Store a value to a collection-key pair if it doesn't already hold a value.
func (*Client) PutIfUnmodified ¶
Store a value to a collection-key pair if the path's ref value is the latest.
func (*Client) PutIfUnmodifiedRaw ¶
Store a value to a collection-key pair if the path's ref value is the latest.
func (*Client) PutRelation ¶
func (c *Client) PutRelation(sourceCollection, sourceKey, kind, sinkCollection, sinkKey string) error
Create a relationship of a specified type between two collection-keys.
func (*Client) Search ¶
func (c *Client) Search( collection, query string, limit, offset int, ) (*SearchResults, error)
Search a collection with a Lucene Query Parser Syntax Query (http://lucene.apache.org/core/4_5_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Overview) and with a specified size limit and offset.
func (*Client) SearchGetNext ¶
func (c *Client) SearchGetNext(results *SearchResults) (*SearchResults, error)
Get the page of search results that follow that provided set.
func (*Client) SearchGetPrev ¶
func (c *Client) SearchGetPrev(results *SearchResults) (*SearchResults, error)
Get the page of search results that precede that provided set.
func (*Client) SearchSorted ¶
func (c *Client) SearchSorted( collection, query, sortBy string, limit, offset int, ) (*SearchResults, error)
Like Search() except this sorts the search results.
sortBy is a dot joined field list followed by either "asc" or "desc". for example: "value.field1:asc" would sort all of the results, ascending by the value in "field1" in each document.
TODO: Add a link to the blog post documenting this.
type Event ¶
type Event struct { Ordinal uint64 `json:"ordinal"` Timestamp uint64 `json:"timestamp"` RawValue json.RawMessage `json:"value"` }
An individual event.
type EventResults ¶
Holds results returned from an Events query.
type GraphResult ¶
type GraphResult struct { Path Path `json:"path"` RawValue json.RawMessage `json:"value"` }
An individual graph result.
func (*GraphResult) Value ¶
func (r *GraphResult) Value(value interface{}) error
Marshall the value of a GraphResult into the provided object.
type GraphResults ¶
type GraphResults struct { Count uint64 `json:"count"` Results []GraphResult `json:"results"` }
Holds results returned from a Graph query.
type KVResult ¶
type KVResult struct { Path Path `json:"path"` RawValue json.RawMessage `json:"value"` }
An individual Key/Value result.
type KVResults ¶
type KVResults struct { Count uint64 `json:"count"` Results []KVResult `json:"results"` Next string `json:"next,omitempty"` }
Holds results returned from a KV list query.
type OrchestrateError ¶
type OrchestrateError struct { // The status string returned from the HTTP call. Status string `json:"-"` // The status, as an integer, returned from the HTTP call. StatusCode int `json:"-"` // The Orchestrate specific message representing the error. Message string `json:"message"` }
An implementation of 'error' that exposes all the orchestrate specific error details.
func (OrchestrateError) Error ¶
func (e OrchestrateError) Error() string
Convert the error to a meaningful string.
type Path ¶
type Path struct { Collection string `json:"collection"` Key string `json:"key"` Ref string `json:"ref"` Tombstone bool `json:"tombstone,omitempty"` }
A representation of a Key/Value object's path within Orchestrate.
type RefResult ¶
type RefResult struct { Path Path `json:"path"` RawValue json.RawMessage `json:"value,omitempty"` RefTime uint64 `json:"reftime"` }
An individual ref result.
type RefResults ¶
type RefResults struct { Count uint64 `json:"count"` Results []RefResult `json:"results"` Next string `json:"next,omitempty"` }
Holds results returned from a ref list.
func (*RefResults) HasNext ¶
func (r *RefResults) HasNext() bool
Check if there is a subsequent page of ref list results.
type SearchResult ¶
type SearchResult struct { Path Path `json:"path"` Score float64 `json:"score"` Distance float64 `json:"distance"` RawValue json.RawMessage `json:"value"` }
An individual search result.
func (*SearchResult) Value ¶
func (r *SearchResult) Value(value interface{}) error
Marshall the value of a SearchResult into the provided object.
type SearchResults ¶
type SearchResults struct { Count uint64 `json:"count"` TotalCount uint64 `json:"total_count"` Results []SearchResult `json:"results"` Next string `json:"next,omitempty"` Prev string `json:"prev,omitempty"` }
Holds results returned from a Search query.
func (*SearchResults) HasNext ¶
func (r *SearchResults) HasNext() bool
Check if there is a subsequent page of search results.
func (*SearchResults) HasPrev ¶
func (r *SearchResults) HasPrev() bool
Check if there is a previous page of search results.