![]() |
VOOZH | about |
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
<PackageReference Include="SurrealDB.Driver.Rpc" Version="1.0.8" />
<PackageVersion Include="SurrealDB.Driver.Rpc" Version="1.0.8" />Directory.Packages.props
<PackageReference Include="SurrealDB.Driver.Rpc" />Project file
paket add SurrealDB.Driver.Rpc --version 1.0.8
#r "nuget: SurrealDB.Driver.Rpc, 1.0.8"
#:package SurrealDB.Driver.Rpc@1.0.8
#addin nuget:?package=SurrealDB.Driver.Rpc&version=1.0.8Install as a Cake Addin
#tool nuget:?package=SurrealDB.Driver.Rpc&version=1.0.8Install as a Cake Tool
π 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>
Surreal .NET is a database driver for SurrealDB. The connector can access the database via JSON-RPC as well as REST.
| 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 |
The API Documentation is available here
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);
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.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)/develop branch)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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.0.8 | 1,279 | 10/15/2022 | 1.0.8 is deprecated because it is no longer maintained. |
| 1.0.7 | 878 | 9/29/2022 | 1.0.7 is deprecated because it is no longer maintained. |
| 1.0.6 | 897 | 9/29/2022 | 1.0.6 is deprecated because it is no longer maintained. |
| 1.0.5 | 882 | 9/26/2022 | 1.0.5 is deprecated because it is no longer maintained. |
| 1.0.4 | 755 | 9/25/2022 | 1.0.4 is deprecated because it is no longer maintained. |
| 1.0.3 | 786 | 9/22/2022 | 1.0.3 is deprecated because it is no longer maintained. |
| 1.0.2 | 765 | 9/21/2022 | 1.0.2 is deprecated because it is no longer maintained. |