Testing initial DB connections
This commit is contained in:
64
Program.cs
64
Program.cs
@@ -1,3 +1,63 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
using SurrealDb.Net;
|
||||||
|
using SurrealDb.Net.Models;
|
||||||
|
using SurrealDb.Net.Models.Auth;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
Console.WriteLine("Hello, World!");
|
const string TABLE = "person";
|
||||||
|
|
||||||
|
using var db = new SurrealDbClient("ws://127.0.0.1:8000/rpc");
|
||||||
|
|
||||||
|
await db.SignIn(new RootAuth { Username = "root", Password = "secret" });
|
||||||
|
await db.Use("test", "test");
|
||||||
|
|
||||||
|
|
||||||
|
// var person = new Person
|
||||||
|
// {
|
||||||
|
// Title = "Founder CEO",
|
||||||
|
// Name = new() { FirstName = "Tobie", LastName = "Morgan Hitchcock" },
|
||||||
|
// Marketing = true
|
||||||
|
// };
|
||||||
|
// var created = await db.Create(TABLE, person);
|
||||||
|
// Console.WriteLine($"Created Person: {ToJsonString(created)}");
|
||||||
|
//
|
||||||
|
// var updated = await db.Merge<ResponsibilityMerge, Person>(
|
||||||
|
// new() { Id = (TABLE, "3bi2i54plwqfqe8u2qiq"), Marketing = false }
|
||||||
|
// );
|
||||||
|
// Console.WriteLine($"Updated Person: {ToJsonString(updated)}");
|
||||||
|
//
|
||||||
|
// var people = await db.Select<Person>(TABLE);
|
||||||
|
// Console.WriteLine($"Select Person: {ToJsonString(people)}");
|
||||||
|
|
||||||
|
var queryResponse = await db.Query(
|
||||||
|
$"SELECT Marketing, count() AS Count FROM type::table({TABLE}) GROUP BY Marketing"
|
||||||
|
);
|
||||||
|
// await db.Delete(TABLE);
|
||||||
|
|
||||||
|
// var groups = queryResponse.GetValue<List<Group>>(0);
|
||||||
|
Console.WriteLine($"Get Value as group: {ToJsonString(queryResponse)}");
|
||||||
|
|
||||||
|
static string ToJsonString(object? o)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(o, new JsonSerializerOptions { WriteIndented = true, });
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Person : Record
|
||||||
|
{
|
||||||
|
public string? Title { get; set; }
|
||||||
|
public Name? Name { get; set; }
|
||||||
|
public bool Marketing { get; set; }
|
||||||
|
}
|
||||||
|
public class Name
|
||||||
|
{
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
}
|
||||||
|
public class ResponsibilityMerge : Record
|
||||||
|
{
|
||||||
|
public bool Marketing { get; set; }
|
||||||
|
}
|
||||||
|
public class Group
|
||||||
|
{
|
||||||
|
public bool Marketing { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
}
|
||||||
@@ -8,4 +8,8 @@
|
|||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="SurrealDb.Net" Version="0.9.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("RelayCore")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("RelayCore")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f8281d23e500ea2193d3ba250c72e52cc6ba5719")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ccbb3e874a5d2b1d5f9bc39960c235c07b5fe29d")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("RelayCore")]
|
[assembly: System.Reflection.AssemblyProductAttribute("RelayCore")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("RelayCore")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("RelayCore")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
851998f658dd2dac9cb5399ab03b4ba71b56fcacf9ba6114b09e7e190bcae806
|
4f5764b42df7cbe872550eb268495ab3739cb29ded503ffcfb83b6b63bb3a5ea
|
||||||
|
|||||||
Binary file not shown.
@@ -50,6 +50,12 @@
|
|||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net9.0": {
|
"net9.0": {
|
||||||
"targetAlias": "net9.0",
|
"targetAlias": "net9.0",
|
||||||
|
"dependencies": {
|
||||||
|
"SurrealDb.Net": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[0.9.0, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
"imports": [
|
"imports": [
|
||||||
"net461",
|
"net461",
|
||||||
"net462",
|
"net462",
|
||||||
|
|||||||
@@ -1,2 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\9.0.4\buildTransitive\net8.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\9.0.4\buildTransitive\net8.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\9.0.4\buildTransitive\net8.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\9.0.4\buildTransitive\net8.0\Microsoft.Extensions.Options.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.binder\9.0.4\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.Binder.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.binder\9.0.4\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.Binder.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,36 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "+jJKSs40Yjo=",
|
"dgSpecHash": "FgXgk22yPWQ=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj",
|
"projectFilePath": "D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj",
|
||||||
"expectedPackageFiles": [],
|
"expectedPackageFiles": [
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\concurrenthashset\\1.3.0\\concurrenthashset.1.3.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\dahomey.cbor\\1.24.3\\dahomey.cbor.1.24.3.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\6.0.0\\microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.configuration\\9.0.4\\microsoft.extensions.configuration.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\9.0.4\\microsoft.extensions.configuration.abstractions.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.configuration.binder\\9.0.4\\microsoft.extensions.configuration.binder.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\9.0.4\\microsoft.extensions.dependencyinjection.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\9.0.4\\microsoft.extensions.dependencyinjection.abstractions.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.diagnostics\\9.0.4\\microsoft.extensions.diagnostics.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.diagnostics.abstractions\\9.0.4\\microsoft.extensions.diagnostics.abstractions.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.http\\9.0.4\\microsoft.extensions.http.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.logging\\9.0.4\\microsoft.extensions.logging.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\9.0.4\\microsoft.extensions.logging.abstractions.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.options\\9.0.4\\microsoft.extensions.options.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.options.configurationextensions\\9.0.4\\microsoft.extensions.options.configurationextensions.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.extensions.primitives\\9.0.4\\microsoft.extensions.primitives.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.io.recyclablememorystream\\3.0.1\\microsoft.io.recyclablememorystream.3.0.1.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\microsoft.spatial\\7.18.0\\microsoft.spatial.7.18.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\semver\\3.0.0\\semver.3.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\surrealdb.net\\0.9.0\\surrealdb.net.0.9.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\system.collections.immutable\\9.0.4\\system.collections.immutable.9.0.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\system.io.pipelines\\7.0.0\\system.io.pipelines.7.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\system.linq.async\\6.0.1\\system.linq.async.6.0.1.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\system.reactive\\6.0.0\\system.reactive.6.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\system.threading.channels\\8.0.0\\system.threading.channels.8.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\systemtextjsonpatch\\4.2.0\\systemtextjsonpatch.4.2.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Core\\.nuget\\packages\\websocket.client\\5.1.2\\websocket.client.5.1.2.nupkg.sha512"
|
||||||
|
],
|
||||||
"logs": []
|
"logs": []
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
"restore":{"projectUniqueName":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj","projectName":"RelayCore","projectPath":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj","outputPath":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net9.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"net9.0":{"targetAlias":"net9.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.305/PortableRuntimeIdentifierGraph.json"}}
|
"restore":{"projectUniqueName":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj","projectName":"RelayCore","projectPath":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\RelayCore.csproj","outputPath":"D:\\DDI\\Relay\\RelayChat\\RelayCore\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net9.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"net9.0":{"targetAlias":"net9.0","dependencies":{"SurrealDb.Net":{"target":"Package","version":"[0.9.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.305/PortableRuntimeIdentifierGraph.json"}}
|
||||||
@@ -1 +1 @@
|
|||||||
17731136919568974
|
17731137598642406
|
||||||
@@ -1 +1 @@
|
|||||||
17731137598642406
|
17731190668997575
|
||||||
Reference in New Issue
Block a user