NAME

DBIO::PostgreSQL::Age::Storage - PostgreSQL storage with Apache AGE graph support

VERSION

version 0.900000

SYNOPSIS

# Loaded automatically via DBIO::PostgreSQL::Age component.
# Use connect_call_load_age to initialize AGE on each connection:

MyApp::Schema->connect(
  $dsn, $user, $pass,
  { on_connect_call => 'load_age' },
);

my $storage = $schema->storage;

$storage->create_graph('social');

my $rows = $storage->cypher(
  'social',
  $$ MATCH (a:Person {name: $name})-[:KNOWS]->(b) RETURN b.name $$,
  ['friend'],
  { name => 'Alice' },
);

$storage->drop_graph('social', 1);  # cascade

DESCRIPTION

Extends DBIO::PostgreSQL::Storage with Apache AGE graph database support. Provides connection initialization, graph lifecycle management, and Cypher query execution.

All result columns from cypher() are declared as agtype — Apache AGE's JSON-superset type that represents vertices, edges, paths, and scalar values. Values are returned as strings and can be decoded with a JSON parser.

METHODS

connect_call_load_age

{ on_connect_call => 'load_age' }

Connection callback that loads the Apache AGE shared library into the session and sets search_path to include ag_catalog. Must be called before any graph operations.

create_graph

$storage->create_graph('social');

Creates a new Apache AGE graph with the given name.

drop_graph

$storage->drop_graph('social');
$storage->drop_graph('social', 1);  # cascade

Drops the named graph. Pass a true second argument to cascade the drop to all vertices and edges within the graph.

cypher

my $rows = $storage->cypher(
  'social',
  $$ MATCH (a:Person)-[:KNOWS]->(b:Person) RETURN a.name, b.name $$,
  [qw( person friend )],
);

# With Cypher parameters:
my $rows = $storage->cypher(
  'social',
  $$ MATCH (n:Person {name: $name}) RETURN n $$,
  ['node'],
  { name => 'Alice' },
);

Executes a Cypher query against the named graph. $columns is an arrayref of result column names; all are declared as agtype. Returns an arrayref of hashrefs with one key per column.

An optional $params hashref is JSON-encoded and passed as AGE's third argument to cypher() for parameterized queries.

AUTHOR

DBIO Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 169:

Unknown directive: =seealso