SurrealDB.Driver.Rpc 1.0.8

Suggested Alternatives

SurrealDb.Net

Additional Details

This project is no longer supported, please use SurrealDb.Net instead.

dotnet add package SurrealDB.Driver.Rpc --version 1.0.8                
NuGet\Install-Package SurrealDB.Driver.Rpc -Version 1.0.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SurrealDB.Driver.Rpc" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SurrealDB.Driver.Rpc --version 1.0.8                
#r "nuget: SurrealDB.Driver.Rpc, 1.0.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SurrealDB.Driver.Rpc as a Cake Addin
#addin nuget:?package=SurrealDB.Driver.Rpc&version=1.0.8

// Install SurrealDB.Driver.Rpc as a Cake Tool
#tool nuget:?package=SurrealDB.Driver.Rpc&version=1.0.8                

Build Status CodeFactor Codacy Badge codecov All Contributors

<br /> <p align="center"> <img src="img/icon.png" alt="Logo" width="130" height="130"> </a> <h1 align="center">Surreal .NET</h1> <p align="center"> Database driver for SurrealDB available for REST and RPC sessions. </p>

<p align="center"> (unofficial) </p>

Table of contents

About

Surreal .NET is a database driver for SurrealDB. The connector can access the database via JSON-RPC as well as REST.

Primary NuGet Packages

Name Description Nuget
SurrealDB.Driver.Rpc Websocket RPC based database driver for SurrealDB NuGet Badge
SurrealDB.Driver.Rest REST based database driver for SurrealDB. NuGet Badge
SurrealDB.Extensions.Service Service integration into the ASP.NET Core ecosystem. NuGet Badge

Documentation

The API Documentation is available here

Quick-start

Firstly install SurrealDB on your system. See the installation instructions:

# Brew
brew install surrealdb/tap/surreal
# Linux
curl -sSf https://install.surrealdb.com | sh
# Windows - system
choco install surreal --pre
# Windows - user
iwr https://windows.surrealdb.com -useb | iex

While Surreal .NET can be registered as a ASP.NET Core service for usage in a web API, the library can also be included in a console app.

I highly recommend taking a looksie at the examples, but for now let's review a basic console app with the RPC library.

<PackageReference Include="SurrealDB.Driver.Rest" Version="1.0.8" />
using SurrealDB.Configuration;
using SurrealDB.Driver.Rpc;
using SurrealDB.Models;

// start server: surreal start -b 0.0.0.0:8082 -u root -p root --log debug
// Create a configuration for the sever specified above.
Config cfg = Config.Create()
    .WithEndpoint("127.0.0.1:8082")
    .WithDatabase("test")
    .WithNamespace("test")
    .WithBasicAuth("root", "root")
    // Tell the configuration to connect to the server using RPC, and without TLS.
    .WithRpc(insecure: true).Build();

// Create a RPC database connection with the configuration.
DatabaseRpc db = new(cfg);
// Connect using the defined connection.
await db.Open();
// Create a struct with the fields we want to insert, nesting is supported.
Person you = new("Max Mustermann", 39, new("Musterstraße 1", 12345, "Musterstadt"), "0123456789", "max@mustermann.de");
// Insert the struct into the database, table = person, id = maxmustermann.
// If id` is not specified it will be random-generated, the id can be read from the response.
RpcResponse create = await db.Create("person:maxmustermann", you);
// Read the struct from the database to verify it was inserted correctly.
RpcResponse select = await db.Select("person:maxmustermann");
if (select.TryGetResult(out Result result)) {
    // Prints: {"address":{"city":"Musterstadt","street":"Musterstraße 1","zip":12345},"age":39,"email":"max@mustermann.de","id":"test:maxmustermann","name":"Max Mustermann","phone":"0123456789"}
    Console.WriteLine(result.Inner);
    Person alsoYou = result.GetObject<Person>();
    // Prints: Yes we equals? True
    Console.WriteLine($"Yes we equals? {you == alsoYou}");
}


/// <summary>
/// A Person.
/// </summary>
record struct Person(string name, int age, Address address, string phone, string email);

/// <summary>
/// The address of one or more people.
/// </summary>
record struct Address(string street, int zip, string city);

Coverage

codecov

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request (Merging into the /develop branch)

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<table> <tbody> <tr> <td align="center"><a href="https://github.com/ProphetLamb"><img src="https://avatars.githubusercontent.com/u/19748542?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ProphetLamb</b></sub></a><br /><a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=ProphetLamb" title="Code">💻</a></td> <td align="center"><a href="https://github.com/StephenGilboy"><img src="https://avatars.githubusercontent.com/u/827735?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stephen Gilboy</b></sub></a><br /><a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=StephenGilboy" title="Code">💻</a></td> <td align="center"><a href="https://antoniosbarotsis.github.io/"><img src="https://avatars.githubusercontent.com/u/50240570?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tony</b></sub></a><br /><a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=AntoniosBarotsis" title="Code">💻</a> <a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=AntoniosBarotsis" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/Du-z"><img src="https://avatars.githubusercontent.com/u/16366766?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brian Duhs</b></sub></a><br /><a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=Du-z" title="Tests">⚠️</a> <a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=Du-z" title="Code">💻</a> <a href="https://github.com/ProphetLamb/Surreal.Net/issues?q=author%3ADu-z" title="Bug reports">🐛</a> <a href="#ideas-Du-z" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="http://siphalor.de/"><img src="https://avatars.githubusercontent.com/u/24505659?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Siphalor</b></sub></a><br /><a href="https://github.com/ProphetLamb/Surreal.Net/commits?author=Siphalor" title="Documentation">📖</a></td> </tr> </tbody> </table>

This project follows the all-contributors specification. Contributions of any kind welcome!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SurrealDB.Driver.Rpc:

Package Downloads
SurrealDB.Extensions.Service

Service integration into the ASP.NET Core ecosystem.

GitHub repositories

This package is not used by any popular GitHub repositories.