-
Notifications
You must be signed in to change notification settings - Fork 9
Datastore.nucleus
Creates a Redis client. The constructor returns a Proxy that interfaces the class and a Promise that resolves once the server is connected.
Adds an item to a hash given a field and its key. HMSET key field value
Parameters
itemKey: String
, Adds an item to a hash given a field and its key. HMSET key field value
itemField: String
, Adds an item to a hash given a field and its key. HMSET key field value
item: *
, Adds an item to a hash given a field and its key. HMSET key field value
hashList: Array
, Adds an item to a hash given a field and its key. HMSET key field value
Returns: Promise.<*>
Adds an item to a list given its key. LPUSH key value
Parameters
itemKey: String
, Adds an item to a list given its key. LPUSH key value
item: *
, Adds an item to a list given its key. LPUSH key value
itemList: Array
, Adds an item to a list given its key. LPUSH key value
Returns: Promise.<*>
Adds an item to a set. SADD key value
Parameters
itemKey: String
, Adds an item to a set. SADD key value
item: String
, Adds an item to a set. SADD key value
Returns: Promise.<*>
Adds a triple to a hexastore.
Parameters
itemKey: String
, Adds a triple to a hexastore.
subject: String
, Adds a triple to a hexastore.
predicate: String
, Adds a triple to a hexastore.
object: String
, Adds a triple to a hexastore.
Returns: Promise.<void>
Creates an item. SET key value
Parameters
itemKey: String
, Creates an item. SET key value
item: *
, Creates an item. SET key value
Returns: Promise.<*>
Destroys the Redis connection.
Returns: Promise
Duplicates the connection.
Parameters
datastoreName: String
, Duplicates the connection.
Returns: NucleusDatastore
Evaluates a LUA script.
Parameters
LUAscript: String
, Evaluates a LUA script.
argumentList: Array
, Evaluates a LUA script.
Returns: Promise.<*>
Executes all handler callback for a given channel name.
Parameters
channelName: String
, Executes all handler callback for a given channel name.
$event: NucleusEvent
, Executes all handler callback for a given channel name.
Returns: Promise
Verifies if an item is part of a given item set.
Parameters
itemKey: String
, Verifies if an item is part of a given item set.
item: String
, Verifies if an item is part of a given item set.
Returns: Promise.<Object>
Handles event published to a specific channel given a handler callback.
Parameters
channelName: String
, Handles event published to a specific channel given a handler callback.
handlerCallback: function
, Handles event published to a specific channel given a handler callback.
Returns: Promise.<Object>
Handles Redis event.
Parameters
argumentList: Array.<String>
, Handles Redis event.
Removes a triple from a hexastore given the subject vector. This will remove every relationship where the given vector is subject or object.
Parameters
itemKey: String
, Removes a triple from a hexastore given the subject vector.
This will remove every relationship where the given vector is subject or object.
vector: String
, Removes a triple from a hexastore given the subject vector.
This will remove every relationship where the given vector is subject or object.
Returns: Promise.<void>
Removes an item given its key. DEL key
Parameters
itemKey: String
, Removes an item given its key. DEL key
Returns: Promise.<null>
Removes an item from a hash given a field. HMDEL key field
Parameters
itemKey: String
, Removes an item from a hash given a field. HMDEL key field
itemField: String
, Removes an item from a hash given a field. HMDEL key field
Returns: Promise.<null>
Retrieves all the items from a hash given its name. HGETALL key
Parameters
itemKey: , Retrieves all the items from a hash given its name. HGETALL key
Returns: Promise.<Array>
Retrieves an item given its key. GET key
Parameters
itemKey: String
, Retrieves an item given its key. GET key
Returns: Promise.<*>
Remove an item from a hash given an item field. HMDEL key field
Parameters
itemKey: String
, Remove an item from a hash given an item field. HMDEL key field
itemField: String
, Remove an item from a hash given an item field. HMDEL key field
itemFieldList: Array.<String>
, Remove an item from a hash given an item field. HMDEL key field
Returns: Promise.<*>
Retrieves an item from a list but blocks the client if the list is empty. BRPOP key timeout
Parameters
itemKey: String
, Retrieves an item from a list but blocks the client if the list is empty. BRPOP key timeout
Returns: Promise
Retrieves the relationship between a subject and an object from a hexastore.
Parameters
itemName: String
, Retrieves the relationship between a subject and an object from a hexastore.
subject: String
, Retrieves the relationship between a subject and an object from a hexastore.
object: String
, Retrieves the relationship between a subject and an object from a hexastore.
Returns: Promise.<Array.<String>>
NucleusDatastore.retrieveVectorByIndexSchemeFromHexastore(itemName, indexingScheme, vectorA, vectorB)
Retrieves the any vector from any triple given the index scheme from a hexastore.
Parameters
itemName: String
, Retrieves the any vector from any triple given the index scheme from a hexastore.
indexingScheme: String
, Retrieves the any vector from any triple given the index scheme from a hexastore.
vectorA: String
, Retrieves the any vector from any triple given the index scheme from a hexastore.
vectorB: String
, Retrieves the any vector from any triple given the index scheme from a hexastore.
Returns: Promise.<Array.<String>>
Example:
async $datastore.addTripleToHexastore('ResourceRelationship', userID, 'isMember', userGroupID);
const relationshipList = async $datastore.retrieveVectorByIndexSchemeFromHexastore('ResourceRelationship', 'SOP', userID, userGroupID);
Subscribes the client to a channel given its name.
Parameters
channelName: String
, Subscribes the client to a channel given its name.
Returns: Promise
Unsubscribes the client from a channel given its name.
Parameters
channelName: String
, Unsubscribes the client from a channel given its name.
Returns: Promise
Parses a hash item list into an object.
Parameters
itemList: Array
, Parses a hash item list into an object.
Returns: Object
Parses an item to a native data type.
Parameters
item: String
, Parses an item to a native data type.
Returns: *
Stringifies a native data type.
Parameters
item: *
, Stringifies a native data type.
Returns: String
Author: Sebastien Filion
Overview: Define the Nucleus Datastore class that wraps a Redis client.