Cyanide.Cypher
4.4.2
dotnet add package Cyanide.Cypher --version 4.4.2
NuGet\Install-Package Cyanide.Cypher -Version 4.4.2
<PackageReference Include="Cyanide.Cypher" Version="4.4.2" />
<PackageVersion Include="Cyanide.Cypher" Version="4.4.2" />
<PackageReference Include="Cyanide.Cypher" />
paket add Cyanide.Cypher --version 4.4.2
#r "nuget: Cyanide.Cypher, 4.4.2"
#addin nuget:?package=Cyanide.Cypher&version=4.4.2
#tool nuget:?package=Cyanide.Cypher&version=4.4.2
Cyanide.Cypher
Cypher query builder is a lightweight and intuitive C# library designed to construct Cypher queries programmatically for use with Neo4j graph database. It simplifies query creation by providing a fluent and type-safe API, allowing developers to focus on query logic rather than string concatenation.
Features
- Fluent query builder: Easily construct Cypher queries using a fluent API.
- Customizable general clauses / subclauses: Support for the following Cypher clauses:
MATCH
,OPTIONAL MATCH
CREATE
RETURN
WHERE
(IS NOT NULL
,IS NULL
,OR
,XOR
,NOT
)WITH
(functionstoUpper
,count
)SKIP
LIMIT
SET
SKIP
REMOVE
ORDER BY
DELETE
,DETACH DELETE
UNION
,UNION ALL
- Customizable administrative clauses: Support for the following Cypher clauses (limited support):
SHOW CURRENT USER
,SHOW USERS
SHOW DATABASE
,SHOW DATABASES
CREATE USER
,CREATE OR REPLACE USER
CREATE DATABASE
START DATABASE
STOP DATABASE
ALTER DATABASE
DROP DATABASE
More information about clauses is available an official site
Getting Started
Prerequisites
- .NET 8 or higher.
- A running instance of a Neo4j database:
- version
4.4
- version
Usage
See more details about all clauses with the project link.
Create a general builder
using Cyanide.Cypher.Builders;
using Cyanide.Cypher.Builders.Queries.General;
IQuery queryBuilder = Factory.QueryBuilder()
Sample
var resultQuery = _queryBuilder
.Match(q =>
q.WithNode(new Entity("Person", "a", [new Field("name", "'Martin Sheen'")]))
)
.Return(q =>
q.WithField("name", "a")
)
.Build();
Output:
MATCH (a:Person {name: 'Martin Sheen'}) RETURN a.name
Create an administrative builder
using Cyanide.Cypher.Builders;
using Cyanide.Cypher.Builders.Queries.Admin;
IAdminQuery adminQueryBuilder = Factory.AdminQueryBuilder();
Sample
var resultQuery = _adminQueryBuilder
.Show(q =>
q.WithDatabases()
)
.Build();
Output:
SHOW DATABASES
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added support for .NET 8.0;
- Added support for Neo4j 4.4;
- Support the general (sub)clauses: MATCH, OPTIONAL MATCH, CREATE, WHERE, WITH, SET, SKIP, LIMIT, REMOVE, DELETE, DETACH DELETE, ORDER BY, UNION, UNION ALL;
- Support the administrative clauses: SHOW DATABASE, SHOW DATABASES, SHOW CURRENT USER, SHOW USERS, CREATE USER, CREATE OR REPLACE USER, CREATE DATABASE, STOP DATABASE, START DATABASE, DROP DATABASE, ALTER DATABASE;