Current section
Files
Jump to
Current section
Files
README.md
# AgexPostgrex extension for the AgensGraph and AGE data types.## InstallationIf [available in Hex](https://hex.pm/docs/publish), the package can be installedby adding `agex` to your list of dependencies in `mix.exs`:```elixirdef deps do [ {:agex, "~> 0.1.0"} ]end```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)and published on [HexDocs](https://hexdocs.pm). Once published, the docs canbe found at [https://hexdocs.pm/agex](https://hexdocs.pm/agex).## Examples```elixir# Create a new Postgrex Types modulePostgrex.Types.define(MyApp.PostgresTypes, [ Agex.Extension.GraphId, Agex.Extension.Vertex, Agex.Extension.Edge, Agex.Extension.Path], [])env = Application.get_env(:agex, :agensdb){:ok, conn} = Postgrex.start_link( hostname: env[:ip], port: env[:port], username: env[:user], password: env[:password], database: env[:db], types: Agex.PostgresTypes )# for Apache AGE, need to load the age extensionPostgrex.query("LOAD 'age';", [])q = """ SET search_path = ag_catalog, "$user", public; """Postgrex.query(q, [])# network is the offical example database of AgensGraphPostgrex.query("set graph_path=network;", [])Postgrex.query("MATCH (p:movie) return p;", [])Postgrex.query("MATCH (:person {name: 'Tom'})-[r:knows]->(:person {name: 'Summer'}) return r;", [])Postgrex.query("MATCH p=(:person {name: 'Tom'})-[:knows]->(:person) RETURN p;", [])```## TODO- add ecto support- add docs