Skip to content

Latest commit

 

History

History
114 lines (80 loc) · 3.52 KB

README.md

File metadata and controls

114 lines (80 loc) · 3.52 KB

Gel.Net

Downloads NuGet Tests Discord

Gel.Net is the official .NET driver for the Gel database.

Documentation

Documentation for the dotnet driver can be found here.

Installation

Gel.Net is distributed through the NuGet package manager. We recommend using the dotnet command or NuGet package manager in Visual Studio:

$ dotnet add package Gel.Net.Driver

Basic usage

Creating a client

Clients are what allow your code to talk and interface with Gel. The GelClientPool class contains a pool of connections and numerous abstractions for executing queries with ease:

using Gel;

var client = new GelClientPool();

Client configuration

GelClientPool will automatically determine how to connect to your Gel instance by resolving Gel Projects. For specifying custom connection arguments, considering checking out the GelConnection class. Here's an example of using the .Create() method:

using Gel;

var connection = GelConnection.Create(
  new GelConnection.Options(){dsn="gel://user:password@localhost:5656/mybranch"}
);
var client = new GelClientPool(connection);

Executing queries

Note: Gel.Net is a fully asynchronous driver, and as such, all I/O operations are performed asynchronously.

Queries are executed through the GelClientPool by using different helper methods. Your choice of method is dependent on the kind of query you're making, better known as cardinality.

Query helper methods will expect a generic T type which is the .NET version of an Gel type:

var result = await client.QueryAsync<long>("select 2 + 2"); // returns 4

Contributing

We openly welcome and accept contributions to Gel.Net! Before writing a GitHub Issue or Pull Request, please see our contribution requirements.

Examples

This repository contains a list of working examples, check them out to see Gel.Net in action!

Compiling

If you're building Gel.Net from source, you will need to download the .NET 8 SDK.

Once you have the SDK installed, you can then run dotnet build in the root directory of the project:

$ dotnet build

Testing

You can run the test suite by using dotnet test like so:

$ dotnet test