module

FalkorDB

FalkorDB is a graph database built on top of Redis that you query using the Cypher query language.

require "falkor"

struct Person
  include FalkorDB::Serializable::Node

  getter id : Int64
  getter name : String
end

redis = Redis::Client.new

# Store the graph data in the Redis key "my-graph"
graph = FalkorDB::Graph.new(redis, "my-graph")

# Create some data in our graph
graph.write_query <<-CYPHER, id: 123, name: "Jamie"
  CREATE (person:Person{id: $id, name: $name})
CYPHER

# The `return` argument specifies the return types of the results in your
# Cypher query's `RETURN` clause
pp graph.read_query(<<-CYPHER, {id: 123}, return: {Person})
  MATCH (person:Person{id: $id})
  RETURN person
CYPHER
# => [{Person(
#       @id=123,
#       @name="Jamie",
#       @node=
#        FalkorDB::Serializable::Node::Metadata(@id=0, @labels=["Person"]))}]

In addition to basic Redis property types, FalkorDB::Serializable types also support Bool, UUID, and Time.

Nested types