Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
190954d
rewrite pool limit logic and internalize raw clients
quinchs Sep 2, 2022
16ecddc
new With* methods
quinchs Sep 10, 2022
d45d12d
inline doc new methods/classes
quinchs Sep 10, 2022
dadd255
Merge branch 'dev' into future/official-client-release
quinchs Sep 10, 2022
327ce79
Update Session.cs
quinchs Sep 10, 2022
811b3a5
fix build errors
quinchs Sep 11, 2022
32a755a
Improve object codec & reader
quinchs Sep 12, 2022
d3faf27
link and sub-object codec initialization
quinchs Sep 12, 2022
3aa7b5b
remove haslink def
quinchs Sep 12, 2022
cc6eea4
fix 64 bit endianness flip & consumers
quinchs Sep 12, 2022
ab56fcd
remove debug code
quinchs Sep 12, 2022
944d186
more optimizations for type builder
quinchs Sep 13, 2022
5999a18
fix exception parameter mismatch
quinchs Sep 13, 2022
0a5e70a
rename exampleapp to examples.csharp
quinchs Sep 14, 2022
16bd13d
add support for F# ValueOption type
quinchs Sep 14, 2022
24dcc71
use compiled lambdas instead of Activator class
quinchs Sep 14, 2022
f87b310
performance optimizations related to codecs
quinchs Sep 14, 2022
cbd8c8a
remove old query builder project
quinchs Sep 14, 2022
fff1629
project structure cleanup
quinchs Sep 14, 2022
d4c5dfa
fix type in F# project
quinchs Sep 14, 2022
ddb0b94
fix build errors
quinchs Sep 14, 2022
03b7612
fix solution wide build errors
quinchs Sep 14, 2022
d1a3d06
Add client side type converters (#35)
quinchs Sep 14, 2022
3c1afd8
Improve snake case property name conversion performance (#36)
Syzuna Sep 15, 2022
820a892
fix dictionary size
quinchs Sep 15, 2022
94f7e06
Start work on writer refactor
quinchs Sep 15, 2022
e9e6c87
fix object codec initialization and codec builder cacheing
quinchs Sep 15, 2022
3c49478
Merge branch 'future/official-client-release' into refactor/packet-wr…
quinchs Sep 15, 2022
b78a477
highly optimize packet writer
quinchs Sep 15, 2022
409ec49
re-internalize binary client and sendables
quinchs Sep 15, 2022
318b2ab
seal all internal and non-open classes
quinchs Sep 15, 2022
093222c
Update SnakeCaseNamingStrategy.cs
quinchs Sep 15, 2022
5608b91
add packet writer tests
quinchs Sep 16, 2022
3f8ab94
make naming strategy opt-in
quinchs Sep 16, 2022
fcff016
add SCRAM tests
quinchs Sep 19, 2022
4f9d971
remove struct copy
quinchs Sep 19, 2022
1e868ec
Update Scram.cs
quinchs Sep 19, 2022
8e52ba0
fix exception with abstract types as results
quinchs Sep 19, 2022
f550945
Squashed commit of the following:
quinchs Sep 19, 2022
6d4a40d
improve PacketWriter memory usage
quinchs Sep 19, 2022
c272dd6
remove experiments project
quinchs Sep 19, 2022
c1ce4e5
Add error formatting
quinchs Sep 20, 2022
5e88cc4
Add summaries to undoc'd public members
quinchs Sep 21, 2022
0e0f451
fix newline mishap with error tests
quinchs Sep 21, 2022
82f7f12
Add more tests
quinchs Sep 21, 2022
696b69d
Add DDL tests and fix config DDL policy
quinchs Sep 27, 2022
d606347
Add disconnect test
quinchs Sep 27, 2022
4ac00ca
use v1 suffix for pre-release
quinchs Sep 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
with:
dotnet-version: 6.0.x

# - uses: edgedb/setup-edgedb@v1.2.2
# with:
# server-version: stable
# instance-name: EdgeDB_Dotnet_Test
- uses: edgedb/setup-edgedb@v1
with:
server-version: stable
instance-name: edgedb_dotnet_tests

# - run: edgedb instance list
- run: edgedb instance list

- name: Restore dependencies
run: dotnet restore
Expand All @@ -33,5 +33,5 @@ jobs:
- name: Unit test
run: dotnet test ./tests/EdgeDB.Tests.Unit --no-build --verbosity normal

# - name: Integration Tests
# run: dotnet test ./tests/EdgeDB.Tests.Integration --no-build --verbosity normal
- name: Integration Tests
run: dotnet test ./tests/EdgeDB.Tests.Integration --no-build --verbosity diag
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# test coverage
tests/EdgeDB.Tests.Integration/coveragereports
CoverageReport

# User-specific files
*.rsuser
*.suo
Expand Down
20 changes: 2 additions & 18 deletions EdgeDB.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Net.Driver", "src\EdgeDB.Net.Driver\EdgeDB.Net.Driver.csproj", "{0C1C6233-388F-4FAE-955B-F0A6D33D44C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Examples.ExampleApp", "examples\EdgeDB.Examples.ExampleApp\EdgeDB.Examples.ExampleApp.csproj", "{B85156A1-66B3-46F1-B238-19B96C4C7729}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Examples.CSharp", "examples\EdgeDB.Examples.CSharp\EdgeDB.Examples.CSharp.csproj", "{B85156A1-66B3-46F1-B238-19B96C4C7729}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Tests.Unit", "tests\EdgeDB.Tests.Unit\EdgeDB.Tests.Unit.csproj", "{CD4A4B5D-4B67-4E64-A13B-3F7BF770B056}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Net.QueryBuilder", "src\EdgeDB.Net.QueryBuilder\EdgeDB.Net.QueryBuilder.csproj", "{4CC2101C-D0AB-4F08-A0FD-205F96958196}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{025AAADF-16AF-4367-9C3D-9E60EDED832F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E6B9FABC-241B-4561-9A94-E67B6BE380E2}"
Expand All @@ -29,13 +27,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Tests.Benchmarks", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.BinaryDebugger", "tools\EdgeDB.BinaryDebugger\EdgeDB.BinaryDebugger.csproj", "{3A4AAAA0-9948-43D3-B838-8EFAC130240C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Experiments", "Experiments", "{49B6FB80-A675-4ECA-802C-2337A4F37566}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Serializer.Experiments", "experiments\EdgeDB.Serializer.Experiments\EdgeDB.Serializer.Experiments.csproj", "{6FA68DEA-D398-4A5B-8025-5F15C728F04C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Examples.ExampleTODOApi", "examples\EdgeDB.Examples.ExampleTODOApi\EdgeDB.Examples.ExampleTODOApi.csproj", "{E38429C6-53A5-4311-8189-1F78238666DC}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "EdgeDB.Example.FSharp", "examples\EdgeDB.Example.FSharp\EdgeDB.Example.FSharp.fsproj", "{F25AA805-163F-46B4-942E-B1A5EBE8383C}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "EdgeDB.Examples.FSharp", "examples\EdgeDB.Examples.FSharp\EdgeDB.Examples.FSharp.fsproj", "{F25AA805-163F-46B4-942E-B1A5EBE8383C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -55,10 +49,6 @@ Global
{CD4A4B5D-4B67-4E64-A13B-3F7BF770B056}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD4A4B5D-4B67-4E64-A13B-3F7BF770B056}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD4A4B5D-4B67-4E64-A13B-3F7BF770B056}.Release|Any CPU.Build.0 = Release|Any CPU
{4CC2101C-D0AB-4F08-A0FD-205F96958196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CC2101C-D0AB-4F08-A0FD-205F96958196}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CC2101C-D0AB-4F08-A0FD-205F96958196}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CC2101C-D0AB-4F08-A0FD-205F96958196}.Release|Any CPU.Build.0 = Release|Any CPU
{1557B745-EB4F-449A-9BE7-180C8990AD47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1557B745-EB4F-449A-9BE7-180C8990AD47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1557B745-EB4F-449A-9BE7-180C8990AD47}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -79,10 +69,6 @@ Global
{3A4AAAA0-9948-43D3-B838-8EFAC130240C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A4AAAA0-9948-43D3-B838-8EFAC130240C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A4AAAA0-9948-43D3-B838-8EFAC130240C}.Release|Any CPU.Build.0 = Release|Any CPU
{6FA68DEA-D398-4A5B-8025-5F15C728F04C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FA68DEA-D398-4A5B-8025-5F15C728F04C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FA68DEA-D398-4A5B-8025-5F15C728F04C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FA68DEA-D398-4A5B-8025-5F15C728F04C}.Release|Any CPU.Build.0 = Release|Any CPU
{E38429C6-53A5-4311-8189-1F78238666DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E38429C6-53A5-4311-8189-1F78238666DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E38429C6-53A5-4311-8189-1F78238666DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -99,13 +85,11 @@ Global
{0C1C6233-388F-4FAE-955B-F0A6D33D44C9} = {025AAADF-16AF-4367-9C3D-9E60EDED832F}
{B85156A1-66B3-46F1-B238-19B96C4C7729} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
{CD4A4B5D-4B67-4E64-A13B-3F7BF770B056} = {E6B9FABC-241B-4561-9A94-E67B6BE380E2}
{4CC2101C-D0AB-4F08-A0FD-205F96958196} = {025AAADF-16AF-4367-9C3D-9E60EDED832F}
{1557B745-EB4F-449A-9BE7-180C8990AD47} = {67ED9EF0-7828-44C0-8CB0-DEBD69EC94CA}
{74DB9D5E-9BA9-4282-90EA-2F7BDC4C4FBD} = {67ED9EF0-7828-44C0-8CB0-DEBD69EC94CA}
{C189294A-4990-4A06-B120-A0AF03A798C6} = {E6B9FABC-241B-4561-9A94-E67B6BE380E2}
{5FFD1E88-614D-409B-8420-F9571AC7CA60} = {E6B9FABC-241B-4561-9A94-E67B6BE380E2}
{3A4AAAA0-9948-43D3-B838-8EFAC130240C} = {67ED9EF0-7828-44C0-8CB0-DEBD69EC94CA}
{6FA68DEA-D398-4A5B-8025-5F15C728F04C} = {49B6FB80-A675-4ECA-802C-2337A4F37566}
{E38429C6-53A5-4311-8189-1F78238666DC} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
{F25AA805-163F-46B4-942E-B1A5EBE8383C} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
EndGlobalSection
Expand Down
2 changes: 1 addition & 1 deletion EdgeDB.Net.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>0.3.3</VersionPrefix>
<VersionPrefix>1.0.0</VersionPrefix>
<LangVersion>latest</LangVersion>
<Authors>EdgeDB.Net Contributors</Authors>
<PackageTags>edgedb;db;database</PackageTags>
Expand Down
8 changes: 8 additions & 0 deletions dbschema/default.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ module default {
type OtherThing extending AbstractThing {
required property attribute -> str;
}

# for type converter example
type UserWithSnowflakeId {
required property user_id -> str {
constraint exclusive;
}
required property username -> str;
}
}
8 changes: 8 additions & 0 deletions dbschema/migrations/00010.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE MIGRATION m1wuplszy5bldaagiqypo6nsdwikppnvhtmkosmksmkl3eipujwloq
ONTO m1yp62tfavybznmg6ywpi7xkbf77ue7ezaubpye7btyv2pco4okf7q
{
CREATE TYPE default::UserWithSnowflakeId {
CREATE REQUIRED PROPERTY user_id -> std::str;
CREATE REQUIRED PROPERTY username -> std::str;
};
};
9 changes: 9 additions & 0 deletions dbschema/migrations/00011.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE MIGRATION m1cpqrhf5f5vdvux4bsgtljnq2sicll7vz4sfmjmztr5ilwgymzc5a
ONTO m1wuplszy5bldaagiqypo6nsdwikppnvhtmkosmksmkl3eipujwloq
{
ALTER TYPE default::UserWithSnowflakeId {
ALTER PROPERTY user_id {
CREATE CONSTRAINT std::exclusive;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

<ItemGroup>
<ProjectReference Include="..\..\src\EdgeDB.Net.Driver\EdgeDB.Net.Driver.csproj" />
<ProjectReference Include="..\..\src\EdgeDB.Net.QueryBuilder\EdgeDB.Net.QueryBuilder.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using EdgeDB.State;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ internal class CancelQueries : IExample

public async Task ExecuteAsync(EdgeDBClient client)
{
await using var singleClient = await client.GetOrCreateClientAsync<EdgeDBBinaryClient>();

var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromTicks(5));

try
{
await singleClient.QueryRequiredSingleAsync<string>("select \"Hello, World\"", token: tokenSource.Token);
await client.QueryRequiredSingleAsync<string>("select \"Hello, World\"", token: tokenSource.Token);
}
catch (OperationCanceledException)
{
Logger!.LogInformation("Got task cancelled exception, client is connected? {Conn}", singleClient.IsConnected);
Logger!.LogInformation("Got task cancelled exception");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using EdgeDB.Serializer;
using EdgeDB.Binary;
using EdgeDB.Binary.Builders;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -78,8 +79,10 @@ public async Task ExecuteAsync(EdgeDBClient client)
});

// Define a custom creator for the 'PersonImmutable' type
TypeBuilder.AddOrUpdateTypeFactory<IPerson>(data =>
TypeBuilder.AddOrUpdateTypeFactory<IPerson>((ref ObjectEnumerator enumerator) =>
{
var data = (IDictionary<string, object?>)enumerator.ToDynamic()!;

Logger?.LogInformation("Custom factory was called");
return new PersonImpl
{
Expand Down
44 changes: 44 additions & 0 deletions examples/EdgeDB.Examples.CSharp/Examples/CustomTypeConverters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using EdgeDB.TypeConverters;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EdgeDB.ExampleApp.Examples
{
internal class CustomTypeConverters : IExample
{
public ILogger? Logger { get; set; }

public class UserWithSnowflakeId
{
public ulong UserId { get; set; }
public string? Username { get; set; }
}

public class UlongTypeConverter : EdgeDBTypeConverter<ulong, string>
{
public override ulong ConvertFrom(string? value)
{
if (value is null)
return 0;

return ulong.Parse(value);
}

public override string? ConvertTo(ulong value)
{
return value.ToString();
}
}

public async Task ExecuteAsync(EdgeDBClient client)
{
var user = await client.QueryAsync<UserWithSnowflakeId>("with u := (insert UserWithSnowflakeId { user_id := \"841451783728529451\", username := \"example\" } unless conflict on .user_id else (select UserWithSnowflakeId)) select u { user_id, username }");

Logger!.LogInformation("User with snowflake id: {@User}", user);
}
}
}
27 changes: 27 additions & 0 deletions examples/EdgeDB.Examples.CSharp/Examples/GlobalsAndConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EdgeDB.ExampleApp.Examples
{
internal class GlobalsAndConfig : IExample
{
public ILogger? Logger { get; set; }

public async Task ExecuteAsync(EdgeDBClient baseClient)
{
var client = baseClient
.WithConfig(conf => conf.AllowDMLInFunctions = true)
.WithGlobals(new Dictionary<string, object?>
{
{ "current_user_id", Guid.NewGuid() }
});

var result = await client.QueryRequiredSingleAsync<Guid>("select global current_user_id");
Logger!.LogInformation("CurrentUserId: {@Id}", result);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -51,11 +51,10 @@ public async Task ExecuteAsync(EdgeDBClient client)
var selectMovieQuery = "select Movie {title, year, director: {name, email}, actors: {name, email}} filter .title = 'Inception'";

await client.ExecuteAsync(createMovieQuery).ConfigureAwait(false);



// select it
var movie = await client.QueryRequiredSingleAsync<Movie>(selectMovieQuery).ConfigureAwait(false);

Logger?.LogInformation("Movie: {@Movie}", movie);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using EdgeDB;
using EdgeDB;
using EdgeDB.ExampleApp;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -20,7 +20,10 @@
loggingBuilder.AddSerilog(dispose: true);
});

services.AddEdgeDB();
services.AddEdgeDB(configure: config =>
{
config.SchemaNamingStrategy = INamingStrategy.SnakeCaseNamingStrategy;
});

services.AddSingleton<ExampleRunner>();
}).Build();
Expand Down
33 changes: 0 additions & 33 deletions examples/EdgeDB.Examples.ExampleApp/Examples/Globals.cs

This file was deleted.

32 changes: 0 additions & 32 deletions examples/EdgeDB.Examples.ExampleApp/Examples/Reconnection.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open EdgeDB

type Person = {
Name: string;
Email: option<string>;
Email: ValueOption<string>;
}

let client = new EdgeDBClient()
Expand Down
Loading