Documentation ¶
Index ¶
- func CheckError(err error, msg string)
- func CheckErrorLog(err error, msg string)
- func CheckReturnError(err error) error
- func CreateCollection(c *Client, fabric, collectionName string, collectionType types.CollectionType, ...)
- func CreateGraph(c *Client, fabric, graphName string, jsonGraph []byte)
- func CreateIndex(c *Client, fabric, collectionName, field string, indexType types.IndexType, ...) (response *index_req.IndexEntry, err error)
- func ImportCollectionData(c *Client, fabric, collectionName string, jsonDocument []byte, silent bool)
- func PrintJsonRes(res types.JsonResponder, verbose bool)
- func PrintQuery(res *query_req.Cursor, verbose bool)
- func PrintRes(res types.Responder, verbose bool)
- func TeardownCollection(c *Client, fabric, collectionName string)
- func TeardownGraph(c *Client, fabric, graphName string, dropCollections bool)
- type APIError
- type Client
- type ClientConfig
- type CollectionManager
- func (c CollectionManager) CheckCollectionExists(fabric, collectionName string) (exists bool, err error)
- func (c CollectionManager) CountCollection(fabric, collectionName string) (response *collection_req.ResultFromCollection, err error)
- func (c CollectionManager) CreateNewCollection(fabric, collectionName string, allowUserKeys bool, ...) (err error)
- func (c CollectionManager) DeleteCollection(fabric, collectionName string, isSystem bool) (err error)
- func (c CollectionManager) GetAllCollections(fabric string) (response *collection_req.ResponseForGetAllCollections, err error)
- func (c CollectionManager) GetCollectionInfo(fabric, collectionName string) (response *collection_req.ResponseForGetCollectionInfo, err error)
- func (c CollectionManager) TruncateCollection(fabric, collectionName string) (response *collection_req.ResponseForTruncateCollection, err error)
- func (c CollectionManager) UpdateCollectionProperties(fabric, collectionName string, properties *collection_req.UpdateOptions) (response *collection_req.ResponseForUpdateCollection, err error)
- type DocumentManager
- func (c DocumentManager) CheckDocumentExists(fabric string, collectionName string, key string) (exists bool, err error)
- func (c DocumentManager) CreateNewDocument(fabric string, collectionName string, silent bool, jsonDocument []byte, ...) (response *document_req.ResponseForCreateDocument, err error)
- func (c DocumentManager) DeleteDocument(fabric string, collectionName string, key string, ...) (response *document_req.ResponseForDeleteDocument, err error)
- func (c DocumentManager) DeleteManyDocuments(fabric string, collectionName string, keysToDelete []byte, ...) (response *document_req.ResponseForDeleteManyDocuments, err error)
- func (c DocumentManager) GetDocument(fabric string, collectionName string, key string) (response *document_req.ResponseForGetJsonDocument, err error)
- func (c DocumentManager) ReplaceDocument(fabric string, collectionName, key string, jsonDocuments []byte, ...) (response *document_req.ResponseForReplaceDocument, err error)
- func (c DocumentManager) ReplaceManyDocuments(fabric string, collectionName string, jsonDocuments []byte, ...) (response *document_req.ResponseForReplaceManyDocument, err error)
- func (c DocumentManager) UpdateDocument(fabric string, collectionName string, key string, jsonDocument []byte, ...) (response *document_req.ResponseForUpdateDocument, err error)
- func (c DocumentManager) UpdateManyDocuments(fabric string, collectionName string, jsonDocument []byte, ...) (response *document_req.ResponseForUpdateManyDocument, err error)
- type GraphManager
- func (c GraphManager) AddEdgeCollection(fabric, graphName, edgeCollectionName, sourceVertex, destinationVertex string) (response *edge_req.ResponseForAddEdgeCollection, err error)
- func (c GraphManager) AddVertexCollection(fabric, graphName, vertexCollectionName string) (response *graph_req.ResponseForGraph, err error)
- func (c GraphManager) CheckEdgeCollectionExists(fabric, collectionName string) (exists bool, err error)
- func (c GraphManager) CheckEdgeExists(fabric, graphName, collectionName, edgeKey string) (exists bool, err error)
- func (c GraphManager) CheckGraphExists(fabric, graphName string) (exists bool, err error)
- func (c GraphManager) CreateEdge(fabric, graphName, edgeCollectionName, sourceVertex, destinationVertex string, ...) (response *edge_req.ResponseForCreateEdge, err error)
- func (c GraphManager) CreateGraph(fabric string, jsonGraph []byte) (response *graph_req.ResponseForCreateGraph, err error)
- func (c GraphManager) CreateVertex(fabric, graphName, collectionName string, jsonDef []byte, returnNew bool) (response *graph_req.ResponseForVertex, err error)
- func (c GraphManager) DeleteEdge(fabric, graphName, collectionName, edgeKey string, returnOld bool) (response *graph_req.ResponseForEdge, err error)
- func (c GraphManager) DeleteEdgeCollection(fabric, graphName, collectionName string, dropCollections bool) (response *graph_req.ResponseForGraph, err error)
- func (c GraphManager) DeleteGraph(fabric, graphName string, dropCollections bool) (response *graph_req.ResponseForDeleteGraph, err error)
- func (c GraphManager) DeleteVertex(fabric, graphName, collectionName, vertexKey string, returnOld bool) (response *graph_req.ResponseForVertex, err error)
- func (c GraphManager) DeleteVertexCollection(fabric, graphName, collectionName string, dropCollections bool) (response *graph_req.ResponseForGraph, err error)
- func (c GraphManager) GetAllEdges(fabric, graphName string) (response *edge_req.ResponseForGetAllEdges, err error)
- func (c GraphManager) GetAllGraphs(fabric string) (response *graph_req.ResponseForGetAllGraphs, err error)
- func (c GraphManager) GetAllVertices(fabric, graphName string) (response *vertex_req.ResponseForGetAllVertices, err error)
- func (c GraphManager) GetEdge(fabric, graphName, collectionName, edgeKey string) (response *graph_req.ResponseForEdge, err error)
- func (c GraphManager) GetGetAllInOutEdges(fabric, edgeCollectionName, vertexKey string, direction types.EdgeDirection) (response *edge_req.ResponseForGetAllInOutEdges, err error)
- func (c GraphManager) GetGraph(fabric, graphName string) (response *graph_req.ResponseForGraph, err error)
- func (c GraphManager) GetVertex(fabric, graphName, collectionName, vertexKey string) (response *graph_req.ResponseForVertex, err error)
- func (c GraphManager) ReplaceEdge(fabric, graphName, edgeCollectionName, edgeKey string, jsonReplace []byte, ...) (response *edge_req.ResponseForReplaceEdge, err error)
- func (c GraphManager) ReplaceVertex(fabric, graphName, collectionName, vertexKey string, jsonReplace []byte, ...) (response *graph_req.ResponseForVertex, err error)
- func (c GraphManager) UpdateEdge(fabric, graphName, edgeCollectionName, edgeKey string, jsonUpdate []byte, ...) (response *graph_req.ResponseForEdge, err error)
- func (c GraphManager) UpdateVertex(fabric, graphName, edgeCollectionName, vertexKey string, jsonUpdate []byte, ...) (response *graph_req.ResponseForVertex, err error)
- type IndexManager
- func (c IndexManager) CreateFulltextIndex(fabric, collectionName, field string, minLength int) (response *index_req.IndexEntry, err error)
- func (c IndexManager) CreateGeoIndex(fabric, collectionName, field string, geoJson bool) (response *index_req.IndexEntry, err error)
- func (c IndexManager) CreateHashIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
- func (c IndexManager) CreatePersistentIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
- func (c IndexManager) CreateSkipListIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
- func (c IndexManager) CreateTTLIndex(fabric, collectionName, field string, expireAfter int) (response *index_req.IndexEntry, err error)
- func (c IndexManager) DeleteIndex(fabric, collectionName, indexName string) (response *index_req.ResponseForDeleteIndex, err error)
- func (c IndexManager) GetIndex(fabric, collectionName, indexName string) (response *index_req.IndexEntry, err error)
- func (c IndexManager) GetIndexes(fabric, collectionName string) (response *index_req.ResponseForGetAllIndices, err error)
- type KVManager
- func (c KVManager) CountKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
- func (c KVManager) CreateNewKVCollection(fabric, collectionName string, expiration bool, ...) (response *kv_req.KVResult, err error)
- func (c KVManager) DeleteKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
- func (c KVManager) DeleteKeyValuePairs(fabric, collectionName string, keys kv_req.KeyCollection) (response *kv_req.KVPairCollection, err error)
- func (c KVManager) DeleteValue(fabric, collectionName, key string) (response *kv_req.KVPair, err error)
- func (c KVManager) GetAllKVCollections(fabric string) (response *kv_req.KVResult, err error)
- func (c KVManager) GetAllKeys(fabric, collectionName string, offset, limit int, order kv_req.Order) (response *kv_req.ResponseForGetAllKeys, err error)
- func (c KVManager) GetAllValues(fabric, collectionName string, offset, limit int, keys kv_req.KeyCollection) (response *kv_req.ResponseForGetAllValues, err error)
- func (c KVManager) GetValue(fabric, collectionName, key string) (response *kv_req.KVPair, err error)
- func (c KVManager) SetKeyValuePairs(fabric, collectionName string, kvPairs kv_req.KVPairCollection) (response *kv_req.KVPairCollection, err error)
- func (c KVManager) TruncateKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
- type QueryManager
- func (c QueryManager) ExplainQuery(fabric, query string) (res *query_req.ResponseForExplainQuery, err error)
- func (c QueryManager) Query(fabric, query string, bindVars map[string]interface{}, ...) (res *query_req.Cursor, err error)
- func (c QueryManager) ValidateQuery(fabric, query string) (res *query_req.ResponseForValidateQuery, err error)
- type QueryWorkerManager
- func (c QueryWorkerManager) CreateQueryWorker(fabric, workerName, queryString, bindVars string) (res *qw_req.ResponseForQueryWorker, err error)
- func (c QueryWorkerManager) DeleteQueryWorker(fabric, workerName string) (err error)
- func (c QueryWorkerManager) ReadAllQueryWorkers(fabric string) (res *qw_req.ResponseForReadAllQueryWorkers, err error)
- func (c QueryWorkerManager) RunQueryWorker(fabric, workerName, bindVars string) (res *query_req.Cursor, err error)
- func (c QueryWorkerManager) UpdateQueryWorker(fabric, workerName, queryString, bindVars string) (res *qw_req.ResponseForQueryWorker, err error)
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶ added in v1.3.1
func CheckErrorLog ¶ added in v1.3.1
func CheckReturnError ¶ added in v1.4.1
func CreateCollection ¶ added in v1.4.1
func CreateCollection(c *Client, fabric, collectionName string, collectionType types.CollectionType, allowUserKeys bool)
func CreateGraph ¶ added in v1.4.1
func CreateIndex ¶ added in v1.4.1
func ImportCollectionData ¶ added in v1.4.1
func PrintJsonRes ¶ added in v0.0.8
func PrintJsonRes(res types.JsonResponder, verbose bool)
func PrintQuery ¶ added in v0.0.8
func TeardownCollection ¶ added in v1.4.1
func TeardownGraph ¶ added in v1.4.1
Types ¶
type APIError ¶
type APIError struct { Code int `json:"code"` IsError bool `json:"error"` ErrorMessage string `json:"errorMessage"` ErrorNum int `json:"errorNum"` }
APIError return the api error
type Client ¶
type Client struct { Endpoint string HTTPC *fasthttp.Client HTTPTimeout time.Duration Collection *CollectionManager Document *DocumentManager Graph *GraphManager Index *IndexManager KV *KVManager Query *QueryManager QueryWorker *QueryWorkerManager // contains filtered or unexported fields }
func NewClient ¶
func NewClient(config *ClientConfig) *Client
type ClientConfig ¶
type ClientConfig struct { Fabric string Timeout int QueryTTL int // contains filtered or unexported fields }
func NewConfig ¶ added in v0.0.3
func NewConfig(apiKey, endpoint, fabric string, timeout int) *ClientConfig
func (ClientConfig) GetApiKey ¶ added in v0.0.3
func (c ClientConfig) GetApiKey() string
func (ClientConfig) GetConnectionString ¶
func (c ClientConfig) GetConnectionString() string
func (ClientConfig) GetQueryTTL ¶ added in v0.0.4
func (c ClientConfig) GetQueryTTL() int
type CollectionManager ¶ added in v1.4.1
type CollectionManager struct {
// contains filtered or unexported fields
}
func NewCollectionManager ¶ added in v1.4.1
func NewCollectionManager(client *Client) *CollectionManager
func (CollectionManager) CheckCollectionExists ¶ added in v1.4.1
func (c CollectionManager) CheckCollectionExists(fabric, collectionName string) (exists bool, err error)
CheckCollectionExists Returns true if the collection of the name exists. False otherwise.
func (CollectionManager) CountCollection ¶ added in v1.4.1
func (c CollectionManager) CountCollection(fabric, collectionName string) (response *collection_req.ResultFromCollection, err error)
CountCollection Returns the number of documents in the collection. Note: This always loads the collection into memory.
The call returns a JSON object with at least the following attributes on success: error: false count: The number of documents inside the collection. id: The id of collection as string. name: The name of collection as string. isSystem: True if the collection is a system collection. searchEnabled: True if the collection is searchable. globallyUniqueId: Global unique identifier as string. https://macrometa.com/docs/api#/operations/handleCommandGet:getCollectionCount
func (CollectionManager) CreateNewCollection ¶ added in v1.4.1
func (c CollectionManager) CreateNewCollection(fabric, collectionName string, allowUserKeys bool, collectionType types.CollectionType) (err error)
CreateNewCollection Creates a new collection with a given name. The request must contain an object with the following attributes. name: The name of the collection. keyOptions: allowUserKeys: If set to true, you can supply a key value in the _key attribute of a document. If set to false, the key generator creates keys, and an error occurs if you add a _key value. type: Choose the type of key generator: traditional: generates numerical keys in ascending order. autoincrement: generates numerical keys in ascending order with configurable initial offset and spacing. padded: generates keys of a fixed length (16 bytes) in ascending lexicographical sort order. uuid64: generates universally unique keys. increment: increment value for autoincrement key generator. Not used for other key generator types. offset: Initial offset value for autoincrement key generator. Not used for other key generator types. isSystem: If true, create a system collection. The collection-name must start with an underscore. Not Applicable for end-users. (The default is false) isLocal: If true, create a local collection. For a local collection data is not replicated across regions. (The default is false) type: The type of the collection to be created. The following values for type are valid (The default is 2): 2: document collection 3: edge collection. stream: If true, create a local stream for collection. (The default is false) shardKeys: The specified shard key determines in which shard a given document is to be stored. Choosing the right shard key can have significant impact on your performance can reduce network traffic and increase performance. https://macrometa.com/docs/api#/operations/handleCommandPost:CreateCollection
func (CollectionManager) DeleteCollection ¶ added in v1.4.1
func (c CollectionManager) DeleteCollection(fabric, collectionName string, isSystem bool) (err error)
DeleteCollection Drops the collection identified by collection-name. If the collection was successfully dropped, an object is returned with the following attributes: error: false id: The identifier of the dropped collection. https://macrometa.com/docs/api#/operations/handleCommandDelete:collection
func (CollectionManager) GetAllCollections ¶ added in v1.4.1
func (c CollectionManager) GetAllCollections(fabric string) (response *collection_req.ResponseForGetAllCollections, err error)
GetAllCollections Returns an object with an attribute collections containing an array of all collection descriptions. The same information is also available in the names as an object with the collection names as keys. By providing the optional query parameter excludeSystem with a value of true, all system collections will be excluded from the response. https://macrometa.com/docs/api#/operations/handleCommandGet
func (CollectionManager) GetCollectionInfo ¶ added in v1.4.1
func (c CollectionManager) GetCollectionInfo(fabric, collectionName string) (response *collection_req.ResponseForGetCollectionInfo, err error)
GetCollectionInfo Fetches the information about collection. https://macrometa.com/docs/api#/operations/handleCommandGet:collectionGetProperties
func (CollectionManager) TruncateCollection ¶ added in v1.4.1
func (c CollectionManager) TruncateCollection(fabric, collectionName string) (response *collection_req.ResponseForTruncateCollection, err error)
TruncateCollection Remove all documents from the collection but leaves the indexes intact. https://macrometa.com/docs/api#/operations/handleCommandPut:truncateCollection
func (CollectionManager) UpdateCollectionProperties ¶ added in v1.4.1
func (c CollectionManager) UpdateCollectionProperties(fabric, collectionName string, properties *collection_req.UpdateOptions) (response *collection_req.ResponseForUpdateCollection, err error)
UpdateCollectionProperties updates collection properties. Note: except for waitForSync and hasStream, collection properties cannot be changed once a collection is created. Changes the properties of a collection. Requires a JSON object with these properties:
hasStream: True if creating a live collection stream. waitForSync: True if waiting for documents to be synchronized to storage. The call returns a JSON object with at least the following attributes on success: id: The identifier of the collection. name: The name of the collection. status: The status of the collection as number. 1: new born collection 2: unloaded 3: loaded 4: in the process of being unloaded 5: deleted 6: loading Every other status indicates a corrupted collection. type: The type of the collection as number. 2: document collection (normal case) 3: edges collection isSystem: True then the collection is a system collection. stream: True if the collection has a local streams associate with it. Note: except for waitForSync and hasStream, collection properties cannot be changed once a collection is created. https://macrometa.com/docs/api#/operations/handleCommandPut:stream
type DocumentManager ¶ added in v1.4.1
type DocumentManager struct {
// contains filtered or unexported fields
}
func NewDocumentManager ¶ added in v1.4.1
func NewDocumentManager(client *Client) *DocumentManager
func (DocumentManager) CheckDocumentExists ¶ added in v1.4.1
func (DocumentManager) CreateNewDocument ¶ added in v1.4.1
func (c DocumentManager) CreateNewDocument( fabric string, collectionName string, silent bool, jsonDocument []byte, parameters *document_req.CreateDocumentParameters) (response *document_req.ResponseForCreateDocument, err error)
CreateNewDocument silent - If set to false, the primary key of the new doc is returned. If set to true, an empty object is returned as response. No meta-data is returned for the created document. This option can be used to save some network traffic. True by default parameters - additional query parameters for non-standard cases. jsonDocument the document to store in the collection
func (DocumentManager) DeleteDocument ¶ added in v1.4.1
func (c DocumentManager) DeleteDocument( fabric string, collectionName string, key string, parameters *document_req.DeleteDocumentParameters) (response *document_req.ResponseForDeleteDocument, err error)
func (DocumentManager) DeleteManyDocuments ¶ added in v1.4.1
func (c DocumentManager) DeleteManyDocuments( fabric string, collectionName string, keysToDelete []byte, parameters *document_req.DeleteDocumentParameters) (response *document_req.ResponseForDeleteManyDocuments, err error)
func (DocumentManager) GetDocument ¶ added in v1.4.1
func (c DocumentManager) GetDocument( fabric string, collectionName string, key string) (response *document_req.ResponseForGetJsonDocument, err error)
func (DocumentManager) ReplaceDocument ¶ added in v1.4.1
func (c DocumentManager) ReplaceDocument( fabric string, collectionName, key string, jsonDocuments []byte, parameters *document_req.ReplaceDocumentParameters) (response *document_req.ResponseForReplaceDocument, err error)
func (DocumentManager) ReplaceManyDocuments ¶ added in v1.4.1
func (c DocumentManager) ReplaceManyDocuments( fabric string, collectionName string, jsonDocuments []byte, parameters *document_req.ReplaceDocumentParameters) (response *document_req.ResponseForReplaceManyDocument, err error)
func (DocumentManager) UpdateDocument ¶ added in v1.4.1
func (c DocumentManager) UpdateDocument( fabric string, collectionName string, key string, jsonDocument []byte, silent bool, parameters *document_req.UpdateDocumentParameters, ) (response *document_req.ResponseForUpdateDocument, err error)
func (DocumentManager) UpdateManyDocuments ¶ added in v1.4.1
func (c DocumentManager) UpdateManyDocuments( fabric string, collectionName string, jsonDocument []byte, parameters *document_req.UpdateDocumentParameters) (response *document_req.ResponseForUpdateManyDocument, err error)
type GraphManager ¶ added in v1.4.1
type GraphManager struct {
// contains filtered or unexported fields
}
func NewGraphManager ¶ added in v1.4.1
func NewGraphManager(client *Client) *GraphManager
func (GraphManager) AddEdgeCollection ¶ added in v1.4.1
func (c GraphManager) AddEdgeCollection(fabric, graphName, edgeCollectionName, sourceVertex, destinationVertex string) (response *edge_req.ResponseForAddEdgeCollection, err error)
AddEdgeCollection Adds an additional edge definition to the graph. This edge definition has to contain a collection and an array of each from and to vertex collections. An edge definition can only be added if this definition is either not used in any other graph, or it is used with exactly the same definition. * edgeCollectionName: The name of the edge collection to be used. * sourceVertex (string): One or many vertex collections that can contain source vertices. * destinationVertex (string): One or many vertex collections that can contain target vertices. https://macrometa.com/docs/api#/operations/AddEdgedefinition
func (GraphManager) AddVertexCollection ¶ added in v1.4.1
func (c GraphManager) AddVertexCollection(fabric, graphName, vertexCollectionName string) (response *graph_req.ResponseForGraph, err error)
AddVertexCollection Adds a vertex collection to the set of orphan collections of the graph. If the collection does not exist, it will be created.
func (GraphManager) CheckEdgeCollectionExists ¶ added in v1.4.1
func (c GraphManager) CheckEdgeCollectionExists(fabric, collectionName string) (exists bool, err error)
CheckEdgeCollectionExists Returns true if the collection of the name exists. False otherwise.
func (GraphManager) CheckEdgeExists ¶ added in v1.4.1
func (c GraphManager) CheckEdgeExists(fabric, graphName, collectionName, edgeKey string) (exists bool, err error)
CheckEdgeExists returns true if the edge exists in the given collection
func (GraphManager) CheckGraphExists ¶ added in v1.4.1
func (c GraphManager) CheckGraphExists(fabric, graphName string) (exists bool, err error)
CheckGraphExists returns true if a graph for the given name exists
func (GraphManager) CreateEdge ¶ added in v1.4.1
func (c GraphManager) CreateEdge(fabric, graphName, edgeCollectionName, sourceVertex, destinationVertex string, jsonPayload []byte, returnNew bool) (response *edge_req.ResponseForCreateEdge, err error)
CreateEdge Creates a new edge in the collection There are two ways to call CreateEdge() A) Custom edge With a custom Json payload, as shown in the example By providing from / to, which in the example are left as empty strings. When using this, jsonPayload must be nil. Using a custom payload allows for custom attributes i.e. "online" and custom primary keys set in the _key field. B) Default edge Just setting from/to fields means no custom attributes are possible and primary keys will be generated by the system. The second scenario helps with bulk inserts of basic relations in which the key isn't of interest. sourceVertex: The source vertex of this edge. Has to be valid within the used edge definition. destinationVertex: The target vertex of this edge. Has to be valid within the used edge definition.
func (GraphManager) CreateGraph ¶ added in v1.4.1
func (c GraphManager) CreateGraph(fabric string, jsonGraph []byte) (response *graph_req.ResponseForCreateGraph, err error)
CreateGraph The creation of a graph requires the name of the graph and a definition of its edges. Note: Requires Administrator permissions to access the GeoFabric and Read Only access on every collection used within this graph. Sample edge definition:
{ "edgeDefinitions": [ { "collection": "edgeName", "from": [ "sourceNode" ], "to": [ "destinationNode" ] } ], "name": "exampleGraph", "options": {} }
func (GraphManager) CreateVertex ¶ added in v1.4.1
func (c GraphManager) CreateVertex(fabric, graphName, collectionName string, jsonDef []byte, returnNew bool) (response *graph_req.ResponseForVertex, err error)
CreateVertex Adds a vertex to the given collection. returnNew - boolean Define if the response should contain the complete new version of the document.Show all... https://macrometa.com/docs/api#/operations/CreateAVertex
func (GraphManager) DeleteEdge ¶ added in v1.4.1
func (c GraphManager) DeleteEdge(fabric, graphName, collectionName, edgeKey string, returnOld bool) (response *graph_req.ResponseForEdge, err error)
DeleteEdge Removes an edge from the collection. https://macrometa.com/docs/api#/operations/RemoveAnEdge
func (GraphManager) DeleteEdgeCollection ¶ added in v1.4.1
func (c GraphManager) DeleteEdgeCollection(fabric, graphName, collectionName string, dropCollections bool) (response *graph_req.ResponseForGraph, err error)
DeleteEdgeCollection Remove one edge definition from the graph. This only removes the edge collection, the vertex collections remain untouched and can still be used in your queries. https://macrometa.com/docs/api#/operations/RemoveAnEdgedefinitionFromTheGraph
func (GraphManager) DeleteGraph ¶ added in v1.4.1
func (c GraphManager) DeleteGraph(fabric, graphName string, dropCollections bool) (response *graph_req.ResponseForDeleteGraph, err error)
DeleteGraph Remove an existing graph object by name. Optionally all collections not used by other graphs can be removed as well. https://macrometa.com/docs/api#/operations/DropAGraph
func (GraphManager) DeleteVertex ¶ added in v1.4.1
func (c GraphManager) DeleteVertex(fabric, graphName, collectionName, vertexKey string, returnOld bool) (response *graph_req.ResponseForVertex, err error)
DeleteVertex Removes a vertex from the collection. returnOld boolean - Define if a presentation of the deleted document should be returned https://macrometa.com/docs/api#/operations/RemoveAVertex
func (GraphManager) DeleteVertexCollection ¶ added in v1.4.1
func (c GraphManager) DeleteVertexCollection(fabric, graphName, collectionName string, dropCollections bool) (response *graph_req.ResponseForGraph, err error)
DeleteVertexCollection Removes a vertex collection from the graph and optionally removes the collection, if it is not used in any other graph. It only removes vertex collections that are no longer part of edge definitions. dropCollection - Remove the collection as well. Collection is only removed if it is not used in other graphs. https://macrometa.com/docs/api#/operations/RemoveVertexCollection
func (GraphManager) GetAllEdges ¶ added in v1.4.1
func (c GraphManager) GetAllEdges(fabric, graphName string) (response *edge_req.ResponseForGetAllEdges, err error)
GetAllEdges Lists all edge collections within this graph. https://macrometa.com/docs/api#/operations/ListEdgedefinitions
func (GraphManager) GetAllGraphs ¶ added in v1.4.1
func (c GraphManager) GetAllGraphs(fabric string) (response *graph_req.ResponseForGetAllGraphs, err error)
GetAllGraphs Lists all graphs stored in this GeoFabric. https://macrometa.com/docs/api#/operations/ListAllGraphs
func (GraphManager) GetAllVertices ¶ added in v1.4.1
func (c GraphManager) GetAllVertices(fabric, graphName string) (response *vertex_req.ResponseForGetAllVertices, err error)
GetAllVertices Lists all vertex collections within this graph. https://macrometa.com/do cs/api#/operations/ListVertexCollections
func (GraphManager) GetEdge ¶ added in v1.4.1
func (c GraphManager) GetEdge(fabric, graphName, collectionName, edgeKey string) (response *graph_req.ResponseForEdge, err error)
GetEdge Gets an edge from the given collection. https://macrometa.com/docs/api#/operations/GetAnEdge
func (GraphManager) GetGetAllInOutEdges ¶ added in v1.4.1
func (c GraphManager) GetGetAllInOutEdges(fabric, edgeCollectionName, vertexKey string, direction types.EdgeDirection) (response *edge_req.ResponseForGetAllInOutEdges, err error)
GetGetAllInOutEdges Returns an array of edges starting or ending in the vertex identified by vertex. direction - Select in or out direction for edges. If ANY is set, all edges are returned.
func (GraphManager) GetGraph ¶ added in v1.4.1
func (c GraphManager) GetGraph(fabric, graphName string) (response *graph_req.ResponseForGraph, err error)
GetGraph Retrieve information for a graph. Returns the edge definitions and orphan collections. https://macrometa.com/docs/api#/operations/GetAGraph
func (GraphManager) GetVertex ¶ added in v1.4.1
func (c GraphManager) GetVertex(fabric, graphName, collectionName, vertexKey string) (response *graph_req.ResponseForVertex, err error)
GetVertex Gets a vertex from the given collection. https://macrometa.com/docs/api#/operations/GetAVertex
func (GraphManager) ReplaceEdge ¶ added in v1.4.1
func (c GraphManager) ReplaceEdge(fabric, graphName, edgeCollectionName, edgeKey string, jsonReplace []byte, returnOld, returnNew bool) (response *edge_req.ResponseForReplaceEdge, err error)
ReplaceEdge Replaces the data of an edge in the collection. https://macrometa.com/docs/api#/operations/ReplaceAnEdge
func (GraphManager) ReplaceVertex ¶ added in v1.4.1
func (c GraphManager) ReplaceVertex(fabric, graphName, collectionName, vertexKey string, jsonReplace []byte, returnOld, returnNew bool) (response *graph_req.ResponseForVertex, err error)
ReplaceVertex Replaces the data of an edge in the collection.
func (GraphManager) UpdateEdge ¶ added in v1.4.1
func (c GraphManager) UpdateEdge(fabric, graphName, edgeCollectionName, edgeKey string, jsonUpdate []byte, keepNull, returnOld, returnNew bool) (response *graph_req.ResponseForEdge, err error)
func (GraphManager) UpdateVertex ¶ added in v1.4.1
func (c GraphManager) UpdateVertex(fabric, graphName, edgeCollectionName, vertexKey string, jsonUpdate []byte, returnOld, returnNew bool) (response *graph_req.ResponseForVertex, err error)
UpdateVertex Updates the data of the specific vertex in the collection. returnNew bool - Define if a presentation of the new document should be returned within the response object. returnOld bool - Define if a presentation of the deleted document should be returned within the response object.
type IndexManager ¶ added in v1.4.1
type IndexManager struct {
// contains filtered or unexported fields
}
func NewIndexManager ¶ added in v1.4.1
func NewIndexManager(client *Client) *IndexManager
func (IndexManager) CreateFulltextIndex ¶ added in v1.4.1
func (c IndexManager) CreateFulltextIndex(fabric, collectionName, field string, minLength int) (response *index_req.IndexEntry, err error)
CreateFulltextIndex Creates fulltext index, if it does not already exist. field: Attribute to index. Must be of text format. minLength: Minimum character length of words to index.
func (IndexManager) CreateGeoIndex ¶ added in v1.4.1
func (c IndexManager) CreateGeoIndex(fabric, collectionName, field string, geoJson bool) (response *index_req.IndexEntry, err error)
CreateGeoIndex Creates a geo index. Note: Geo indexes are always sparse, meaning that documents that do not contain the index attributes or have non-numeric values in the index attributes will not be indexed.
func (IndexManager) CreateHashIndex ¶ added in v1.4.1
func (c IndexManager) CreateHashIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
CreateHashIndex * fields (string): an array of attribute paths. * unique: if true, then create a unique index. * sparse: if true, then create a sparse index. * deduplicate: if false, the deduplication of array values is turned off. Creates a hash index for the collection collection-name if it does not already exist. The call expects an object containing the index details. In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set. In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set. Note: unique indexes on non-shard keys are not supported in a cluster. https://macrometa.com/docs/api#/operations/createIndex:hash
func (IndexManager) CreatePersistentIndex ¶ added in v1.4.1
func (c IndexManager) CreatePersistentIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
CreatePersistentIndex Creates a persistent index for the collection collection-name, if it does not already exist. The call expects an object containing the index details. field (string): An array of attribute paths. unique: True if the index is unique. type: Must be equal to "persistent". sparse: True if the index is sparse type. deduplicate: It controls whether inserting duplicate index values from the same document into a unique array index will lead to a unique constraint error or not. (The default is true) Note: In a sparse index all documents are excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents are not indexed and are not taken into account for uniqueness checks if the unique flag is set. In a non-sparse index, these documents are indexed (for non-present indexed attributes, a value of null is used) and are taken into account for uniqueness checks if the unique flag is set. unique indexes on non-shard keys are not supported in a cluster. https://macrometa.com/docs/api#/operations/createIndex:persistent
func (IndexManager) CreateSkipListIndex ¶ added in v1.4.1
func (c IndexManager) CreateSkipListIndex(fabric, collectionName, field string, deduplicate, sparse, unique bool) (response *index_req.IndexEntry, err error)
CreateSkipListIndex Creates a skiplist index for the collection collection-name, if it does not already exist. The call expects an object containing the index details. fields (string): an array of attribute paths. unique: if true, then create a unique index. type: must be equal to "skiplist". sparse: if true, then create a sparse index. deduplicate: if false, the deduplication of array values is turned off.
In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set. In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set. Note: unique indexes on non-shard keys are not supported in a cluster. https://macrometa.com/docs/api#/operations/createIndex:skiplist
func (IndexManager) CreateTTLIndex ¶ added in v1.4.1
func (c IndexManager) CreateTTLIndex(fabric, collectionName, field string, expireAfter int) (response *index_req.IndexEntry, err error)
CreateTTLIndex Creates a TTL index for the collection collection-name if it does not already exist. The call expects an object containing the index details. fields (string): An array with exactly one attribute path. type: Must be equal to "ttl". expireAfter: The time (in seconds) after a document's creation after which the documents count as "expired". https://macrometa.com/docs/api#/operations/createIndex:ttl
func (IndexManager) DeleteIndex ¶ added in v1.4.1
func (c IndexManager) DeleteIndex(fabric, collectionName, indexName string) (response *index_req.ResponseForDeleteIndex, err error)
DeleteIndex Remove an index. https://macrometa.com/docs/api#/operations/dropIndex
func (IndexManager) GetIndex ¶ added in v1.4.1
func (c IndexManager) GetIndex(fabric, collectionName, indexName string) (response *index_req.IndexEntry, err error)
GetIndex Fetches the information about index. https://macrometa.com/docs/api#/operations/getIndexes:handle
func (IndexManager) GetIndexes ¶ added in v1.4.1
func (c IndexManager) GetIndexes(fabric, collectionName string) (response *index_req.ResponseForGetAllIndices, err error)
GetIndexes Fetches the list of all indexes of a collection. https://macrometa.com/docs/api#/operations/getIndexes
type KVManager ¶ added in v1.4.1
type KVManager struct {
// contains filtered or unexported fields
}
func NewKVManager ¶ added in v1.4.1
func (KVManager) CountKVCollection ¶ added in v1.4.1
func (c KVManager) CountKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
CountKVCollection Get number of key-value pairs in collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--count/get
func (KVManager) CreateNewKVCollection ¶ added in v1.4.1
func (c KVManager) CreateNewKVCollection(fabric, collectionName string, expiration bool, options *kv_req.CreateKVOptions) (response *kv_req.KVResult, err error)
CreateNewKVCollection Create key-value collection. https://macrometa.com/docs/api#/operations/CreateNamespace
func (KVManager) DeleteKVCollection ¶ added in v1.4.1
func (c KVManager) DeleteKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
DeleteKVCollection Delete collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection/delete
func (KVManager) DeleteKeyValuePairs ¶ added in v1.4.1
func (c KVManager) DeleteKeyValuePairs(fabric, collectionName string, keys kv_req.KeyCollection) (response *kv_req.KVPairCollection, err error)
DeleteKeyValuePairs Remove key-value collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--values/delete
func (KVManager) DeleteValue ¶ added in v1.4.1
func (c KVManager) DeleteValue(fabric, collectionName, key string) (response *kv_req.KVPair, err error)
DeleteValue Remove key-value pair. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--value--key/delete
func (KVManager) GetAllKVCollections ¶ added in v1.4.1
GetAllKVCollections Lists all collections. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv/get
func (KVManager) GetAllKeys ¶ added in v1.4.1
func (c KVManager) GetAllKeys(fabric, collectionName string, offset, limit int, order kv_req.Order) (response *kv_req.ResponseForGetAllKeys, err error)
GetAllKeys Get keys from key-value collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--keys/get
func (KVManager) GetAllValues ¶ added in v1.4.1
func (c KVManager) GetAllValues(fabric, collectionName string, offset, limit int, keys kv_req.KeyCollection) (response *kv_req.ResponseForGetAllValues, err error)
GetAllValues Get key-value pairs from collection. Optional list of keys. Max limit is 100 keys per request. https://macrometa.com/docs/api#/operations/GetValues
func (KVManager) GetValue ¶ added in v1.4.1
func (c KVManager) GetValue(fabric, collectionName, key string) (response *kv_req.KVPair, err error)
GetValue Get value from key-value collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--value--key/get
func (KVManager) SetKeyValuePairs ¶ added in v1.4.1
func (c KVManager) SetKeyValuePairs(fabric, collectionName string, kvPairs kv_req.KVPairCollection) (response *kv_req.KVPairCollection, err error)
SetKeyValuePairs Set one or more key-value pairs in key-value collection. If the input is an array of objects then key-value pairs are created in batch. If the key does not exist the key-value pairs are created. Otherwise the entry for the key is updated. Specify expiration in UTC timestamp. Max limit is 100 key-value pairs per request. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--value/put
func (KVManager) TruncateKVCollection ¶ added in v1.4.1
func (c KVManager) TruncateKVCollection(fabric, collectionName string) (response *kv_req.KVResult, err error)
TruncateKVCollection Remove all key-value pairs in a collection. https://macrometa.com/docs/api#/paths/_fabric-fabric--_api-kv--collection--truncate/put
type QueryManager ¶ added in v1.4.5
type QueryManager struct {
// contains filtered or unexported fields
}
func NewQueryManager ¶ added in v1.5.1
func NewQueryManager(client *Client) *QueryManager
func (QueryManager) ExplainQuery ¶ added in v1.4.5
func (c QueryManager) ExplainQuery(fabric, query string) (res *query_req.ResponseForExplainQuery, err error)
func (QueryManager) Query ¶ added in v1.4.5
func (c QueryManager) Query(fabric, query string, bindVars map[string]interface{}, options *query_req.CursorOptions) (res *query_req.Cursor, err error)
Query Queries database / graph
func (QueryManager) ValidateQuery ¶ added in v1.4.5
func (c QueryManager) ValidateQuery(fabric, query string) (res *query_req.ResponseForValidateQuery, err error)
ValidateQuery validates a C8QL query. To actually query the database, see Query https://macrometa.com/docs/api#/operations/parseQuery
type QueryWorkerManager ¶ added in v1.5.1
type QueryWorkerManager struct {
// contains filtered or unexported fields
}
func NewQueryWorkerManager ¶ added in v1.5.1
func NewQueryWorkerManager(client *Client) *QueryWorkerManager
func (QueryWorkerManager) CreateQueryWorker ¶ added in v1.5.1
func (c QueryWorkerManager) CreateQueryWorker(fabric, workerName, queryString, bindVars string) (res *qw_req.ResponseForQueryWorker, err error)
CreateQueryWorker Save a query for a user for a fabric. bindVars: bindVars for the query name: Name for the query value: value of the query https://macrometa.com/docs/api#/operations/SaveRestqlByName
func (QueryWorkerManager) DeleteQueryWorker ¶ added in v1.5.1
func (c QueryWorkerManager) DeleteQueryWorker(fabric, workerName string) (err error)
DeleteQueryWorker Delete a query under the given fabric. https://macrometa.com/docs/api#/operations/DeleteRestqlByName
func (QueryWorkerManager) ReadAllQueryWorkers ¶ added in v1.5.1
func (c QueryWorkerManager) ReadAllQueryWorkers(fabric string) (res *qw_req.ResponseForReadAllQueryWorkers, err error)
ReadAllQueryWorkers Get list of saved queries for the fabric. https://macrometa.com/docs/api#/operations/ListRestqlAssociatedWithCurrentUser
func (QueryWorkerManager) RunQueryWorker ¶ added in v1.5.1
func (c QueryWorkerManager) RunQueryWorker(fabric, workerName, bindVars string) (res *query_req.Cursor, err error)
RunQueryWorker Run a saved query for a given fabric. If there are more that 100 records, the hasMore flag is set to true. Note this client fetches all additional records, merges them, and returns just one combined result. https://macrometa.com/docs/api#/operations/ExecuteRestqlByName
func (QueryWorkerManager) UpdateQueryWorker ¶ added in v1.5.1
func (c QueryWorkerManager) UpdateQueryWorker(fabric, workerName, queryString, bindVars string) (res *qw_req.ResponseForQueryWorker, err error)
UpdateQueryWorker Update a saved query for a fabric. https://macrometa.com/docs/api#/operations/UpdateRestqlByName
Source Files ¶
- client.go
- client_config.go
- client_manager_collection.go
- client_manager_document.go
- client_manager_graph.go
- client_manager_graph_edge.go
- client_manager_graph_vertex.go
- client_manager_index.go
- client_manager_kv.go
- client_manager_query.go
- client_manager_query_worker.go
- client_util_create.go
- client_util_err.go
- client_util_print.go
- client_util_teardown.go
- http_error.go
- http_request.go
- http_response.go