Skip to content

RatioPBC/postgrex_agtype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgrexAgtype

A Postgrex.Extension to support Apache AGE agtype using libgraph.

Usage

Add this package as a dependency:

    {:postgrex_agtype, "~> 0.1.0"}

Add an extension file to your code base, specifying JSON parser of choice:

lib/example/postgrex_types.ex:

Postgrex.Types.define(
  Example.PostgresTypes,
  [PostgrexAgtype.Extension],
  json: Jason
)

Query a graph type from the server:

SELECT *
FROM cypher('example_graph', $$
    WITH [
        {id: 0, label: "label_name_1", properties: {i: 0}}::vertex,
        {id: 2, start_id: 0, end_id: 1, label: "edge_label", properties: {i: 0}}::edge,
        {id: 1, label: "label_name_2", properties: {}}::vertex
    ]::path as p

    RETURN p
$$) AS (result agtype)
#Graph<type: directed, vertices: [1, 0], edges: [0 -[%{"id" => 2, "label" => "edge_label", "properties" => %{"i" => 0}}]-> 1]>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages