Skip to content

peteglassey/pg-age

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ApacheAGE

Nuget

What is Apache AGE?

Apache AGE is an open-source extension for PostgreSQL which provides it with the capabilities of a graph database.

Quickstart

Here's a simple example to get you started:

using ApacheAGE;
using ApacheAGE.Types;
using Npgsql;

var connectionString = "Host=server;Port=5432;Username=user;Password=pass;Database=sample1";
var npgsqlConnection = new NpgsqlConnection(connectionString);

// Create a client.
var clientBuilder = new AgeClientBuilder(npgsqlConnection);
await using var client = clientBuilder.Build();
await client.OpenConnectionAsync();

// Create a graph and add vertices.
await client.CreateGraphAsync("graph1");
await client.ExecuteCypherAsync("graph1", "CREATE (:Person {age: 23}), (:Person {age: 78})");
await using var reader = await client.ExecuteQueryAsync(
@"SELECT * FROM cypher('graph1', $$
    MATCH (n:Person)
    RETURN n
$$) AS (persons agtype);");

// Read the result row by row.
while(await reader.ReadAsync())
{
    var agtypeResult = reader.GetValue<Agtype>(0);
    Vertex person = agtypeResult.GetVertex();
    Console.WriteLine(person);
}

Note

The AgeClientBuilder constructor now accepts an NpgsqlConnection object as an optional parameter. This allows you to reuse an existing connection if needed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%