struct Redis::Graph::Client(Runnable)
- Redis::Graph::Client(Runnable)
- Struct
- Value
- Object
Defined in:
graph.crConstructors
Instance Method Summary
-
#multi(&)
Execute a transaction within the given graph
EXPERIMENTAL This method may be difficult to use, since it relies primarily on
Redis::Client#multi
, which is not graph-aware. It is currently intended primarily to roll back previous writes if others do not succeed when a single query is not feasible. This may be iterated on in the future. -
#read_query(cypher : String, params : NamedTuple | Hash, return types : Tuple(*T)) forall T
Query the graph with the given Cypher query, passing in the given params, and returning the given types corresponding to the values in your Cypher
RETURN
clause. - #read_query(cypher : String, params : NamedTuple | Hash, return type : T.class) forall T
- #read_query(cypher : String, return types : Tuple(*T)) forall T
-
#read_query(cypher : String)
Query the graph with the given Cypher query.
-
#read_query(cypher : String, **params)
Query the graph with the given Cypher query, passing in the given params.
-
#write_query(cypher : String, params : NamedTuple | Hash, return types : Tuple(*T)) forall T
Write data to the graph using the given cypher query, passing in the given params and returning the given types for the values in your query's
RETURN
clause. - #write_query(cypher : String, params : NamedTuple | Hash, return type : T.class) forall T
-
#write_query(cypher : String)
Write data to this graph using the given Cypher query.
-
#write_query(cypher : String, **params)
Write data to the graph using the given cypher query, passing in the given query parameters.
Constructor Detail
Instance Method Detail
Execute a transaction within the given graph
graph.multi do |txn|
txn.write_query <<-CYPHER, team_id: 123
MATCH (
CYPHER
end
EXPERIMENTAL This method may be difficult to use, since it relies primarily on Redis::Client#multi
, which is not graph-aware. It is currently intended primarily to roll back previous writes if others do not succeed when a single query is not feasible. This may be iterated on in the future.
Query the graph with the given Cypher query, passing in the given
params, and returning the given types corresponding to the values in
your Cypher RETURN
clause.
graph.read_query <<-CYPHER, {team_id: 123}, return: {Person}
MATCH (team:Team{id: $team_id})
MATCH (person)-[:MEMBER_OF]->(team)
RETURN person
CYPHER
Query the graph with the given Cypher query.
graph.read_query <<-CYPHER
MATCH (person:Person)
RETURN person
CYPHER
Query the graph with the given Cypher query, passing in the given params.
graph.read_query <<-CYPHER, team_id: 123
MATCH (team:Team{id: $team_id})
MATCH (person)-[membership:MEMBER_OF]->(team)
RETURN person, membership, team
CYPHER
Write data to the graph using the given cypher query, passing in the
given params and returning the given types for the values in your
query's RETURN
clause.
graph.write_query <<-CYPHER, {id: 123, now: Time.utc.to_unix_ms}, return: {Person}
MATCH (person:Person{id: $id})
SET person.confirmed_at = $now
RETURN person
CYPHER
Write data to this graph using the given Cypher query.
graph.write_query "MATCH (u:User{active: true}) SET u:ActiveUser, u.active = null"
Write data to the graph using the given cypher query, passing in the given query parameters.