Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet edgeql tool #3

Open
wants to merge 42 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a214b21
rebase to v1 driver
quinchs Nov 7, 2022
a6bd407
change watch mode behaviour
quinchs Nov 7, 2022
4359da7
add debug logging and fix deadlock
quinchs Nov 7, 2022
c219966
update cli tool name
quinchs Nov 7, 2022
586ac99
add namespace resolution
quinchs Nov 7, 2022
c0745c3
fix typo
quinchs Nov 8, 2022
8440168
Merge branch 'dev' into feat/cli-tool
quinchs Nov 14, 2022
f76e694
Merge branch 'dev' into feat/cli-tool
quinchs Nov 29, 2022
f58ca8e
Update EdgeQLParser.cs
quinchs Nov 29, 2022
e1bf19c
restructure generator for integration of manifests
quinchs Dec 2, 2022
e974174
add logic step for type manifests
quinchs Dec 5, 2022
f2e1817
Add XML doc generation and implement type manifest
quinchs Dec 6, 2022
775541f
remove schema property mode
quinchs Dec 6, 2022
2626e8b
doc new generator
quinchs Dec 6, 2022
17e30c3
fix generator bugs
quinchs Dec 14, 2022
292f08d
fix capabilities being incorrectly set for parse
quinchs Dec 14, 2022
c4e73ab
fix unescaped edgeql and stack overflow with hash
quinchs Dec 14, 2022
343e50d
Merge branch 'dev' into feat/cli-tool
quinchs Dec 28, 2022
8b14035
Update EdgeDBBinaryClient.cs
quinchs Dec 28, 2022
13e1d46
remove type manifests
quinchs Dec 28, 2022
abb8506
start work on abstracting protocol
quinchs Jul 6, 2023
206c70c
Complete protocol abstraction
quinchs Jul 7, 2023
b0145b9
v2 protocol and descriptors
quinchs Jul 10, 2023
93ba337
Merge branch 'dev' into feat/protocol2.0
quinchs Jul 11, 2023
59b2f4f
test out protocol and fix issues
quinchs Jul 12, 2023
ad6ce43
fix protocol negotiation step
quinchs Jul 13, 2023
2262178
fix build errors and visiting logic for results
quinchs Jul 13, 2023
2f9497b
http client uses new protocol abstraction
quinchs Jul 13, 2023
a673b2b
Merge branch 'dev' into feat/cli-tool
quinchs Jul 14, 2023
cf65b80
Merge branch 'dev' into feat/protocol2.0
quinchs Jul 14, 2023
006862c
Merge branch 'feat/protocol2.0' into feat/cli-tool
quinchs Jul 14, 2023
f82a21d
update code to new protocol
quinchs Jul 14, 2023
eead235
restructure generator
quinchs Jul 17, 2023
2719b71
Merge branch 'dev' into feat/cli-tool
quinchs Jul 18, 2023
e558e74
v1 type generation
quinchs Jul 18, 2023
ccfdc1d
V2 codegen
quinchs Jul 19, 2023
ee0a1b7
comment out old benchmark
quinchs Jul 19, 2023
7abf62e
complete generation logic
quinchs Jul 24, 2023
b946791
fix ancestors being incorrectly fetched
quinchs Jul 27, 2023
aa767ba
fix Id not being populated on Array v2 descriptor
quinchs Jul 27, 2023
8924be2
fix descriptor/codec ids
quinchs Jul 27, 2023
f3bb732
fix build errors
quinchs Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

**/.DS_Store

# test coverage
tests/EdgeDB.Tests.Integration/coveragereports
CoverageReport
Expand Down Expand Up @@ -380,3 +382,6 @@ MigrationBackup/
FodyWeavers.xsd
src/EdgeDB.ExampleApp/dump.db
docs/tmp/*

# EdgeDB.Net CLI watcher info file
edgeql.dotnet.watcher.process
26 changes: 25 additions & 1 deletion EdgeDB.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Examples.ExampleTODO
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "EdgeDB.Examples.FSharp", "examples\EdgeDB.Examples.FSharp\EdgeDB.Examples.FSharp.fsproj", "{F25AA805-163F-46B4-942E-B1A5EBE8383C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdgeDB.DocGenerator", "tools\EdgeDB.DocGenerator\EdgeDB.DocGenerator.csproj", "{776EAE34-5A30-45B0-9277-C399CC2ABA53}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.DocGenerator", "tools\EdgeDB.DocGenerator\EdgeDB.DocGenerator.csproj", "{776EAE34-5A30-45B0-9277-C399CC2ABA53}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Net.CLI", "src\EdgeDB.Net.CLI\EdgeDB.Net.CLI.csproj", "{AC6DAA7B-5510-47BF-9759-1A16565F24A8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Examples.GenerationExample", "examples\EdgeDB.Examples.GenerationExample\EdgeDB.Examples.GenerationExample.csproj", "{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeGen", "CodeGen", "{C9B0F9DB-E508-4AC1-87E5-BD82A8AB007A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdgeDB.Generated", "examples\EdgeDB.Examples.GenerationExample\EdgeDB.Generated\EdgeDB.Generated.csproj", "{DE74C2DA-4649-44E9-83E9-1E897F61ED6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -83,6 +91,18 @@ Global
{776EAE34-5A30-45B0-9277-C399CC2ABA53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{776EAE34-5A30-45B0-9277-C399CC2ABA53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{776EAE34-5A30-45B0-9277-C399CC2ABA53}.Release|Any CPU.Build.0 = Release|Any CPU
{AC6DAA7B-5510-47BF-9759-1A16565F24A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC6DAA7B-5510-47BF-9759-1A16565F24A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC6DAA7B-5510-47BF-9759-1A16565F24A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC6DAA7B-5510-47BF-9759-1A16565F24A8}.Release|Any CPU.Build.0 = Release|Any CPU
{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866}.Release|Any CPU.Build.0 = Release|Any CPU
{DE74C2DA-4649-44E9-83E9-1E897F61ED6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE74C2DA-4649-44E9-83E9-1E897F61ED6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE74C2DA-4649-44E9-83E9-1E897F61ED6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE74C2DA-4649-44E9-83E9-1E897F61ED6F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -99,6 +119,10 @@ Global
{E38429C6-53A5-4311-8189-1F78238666DC} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
{F25AA805-163F-46B4-942E-B1A5EBE8383C} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
{776EAE34-5A30-45B0-9277-C399CC2ABA53} = {67ED9EF0-7828-44C0-8CB0-DEBD69EC94CA}
{AC6DAA7B-5510-47BF-9759-1A16565F24A8} = {025AAADF-16AF-4367-9C3D-9E60EDED832F}
{EAA9EF1A-0F10-4F74-B2F4-1C5BBC505866} = {C9B0F9DB-E508-4AC1-87E5-BD82A8AB007A}
{C9B0F9DB-E508-4AC1-87E5-BD82A8AB007A} = {6FC214F5-C912-4D99-91B1-3E9F52A4E11B}
{DE74C2DA-4649-44E9-83E9-1E897F61ED6F} = {C9B0F9DB-E508-4AC1-87E5-BD82A8AB007A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4E90C94F-D693-4411-82F3-2051DE1BE052}
Expand Down
2 changes: 1 addition & 1 deletion edgedb.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[edgedb]
server-version = "nightly"
server-version = "3.0"
2 changes: 2 additions & 0 deletions examples/EdgeDB.Examples.CSharp/Examples/AbstractTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class OtherThing : AbstractThing

public async Task ExecuteAsync(EdgeDBClient client)
{
var aa = await client.QueryAsync<string>("select 'Hello world'");

// select the abstract type from the schema.
// Note that the type builder will 'discover' the types that inherit
// our C# abstract type.
Expand Down
2 changes: 1 addition & 1 deletion examples/EdgeDB.Examples.CSharp/Examples/JsonResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task ExecuteAsync(EdgeDBClient client)
{
var result = await client.QueryJsonAsync("select Person {name, email}");

var people = JsonConvert.DeserializeObject<Person[]>(result)!;
var people = JsonConvert.DeserializeObject<Person[]>(result!)!;

Logger!.LogInformation("People from json: {@People}", people);
}
Expand Down
4 changes: 1 addition & 3 deletions examples/EdgeDB.Examples.CSharp/Examples/Range.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using EdgeDB.DataTypes;
using EdgeDB.DataTypes;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
Expand All @@ -15,8 +15,6 @@ internal class RangeExample : IExample
public async Task ExecuteAsync(EdgeDBClient client)
{
var range = await client.QuerySingleAsync<Range<long>>("select range(1, 10)");


}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Compile Remove="EdgeDB.Generated\**" />
<EmbeddedResource Remove="EdgeDB.Generated\**" />
<None Remove="EdgeDB.Generated\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="EdgeDB.Generated\EdgeDB.Generated.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// AUTOGENERATED: DO NOT MODIFY
// edgeql:B9692A5CA0A9992246361197BEACBDE398A5A30C5DCCC83BCACD8C80D5842FEB
// Generated on 2023-07-24T15:15:21.8729863Z
#nullable enable
using EdgeDB;
using EdgeDB.DataTypes;

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace EdgeDB.Generated;

public static class CreateUser
{
/// <summary>
/// The string containing the query defined in <c>C:\Users\lynch\source\repos\EdgeDB\examples\EdgeDB.Examples.GenerationExample\Scripts\CreateUser.edgeql</c>.
/// </summary>
public static readonly string Query;
private static readonly string _queryHex = "494E5345525420506572736F6E207B0D0A20206E616D65203A3D203C7374723E246E616D652C0D0A2020656D61696C203A3D203C7374723E24656D61696C0D0A7D0D0A554E4C45535320434F4E464C494354204F4E202E656D61696C200D0A454C5345202853454C45435420506572736F6E29";


static CreateUser()
{
Query = string.Join("", Regex.Split(_queryHex, "(?<=\\G..)(?!$)").Select(x => (char)Convert.ToByte(x, 16)));
}

/// <summary>
/// Executes the CreateUser query, defined as:
/// <code>
/// INSERT Person {
/// name := &lt;str&gt;$name,
/// email := &lt;str&gt;$email
/// }
/// UNLESS CONFLICT ON .email
/// ELSE (SELECT Person)
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="name">The name parameter in the query.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<CreateUserResult> ExecuteAsync(IEdgeDBQueryable client, String name, String email, CancellationToken token = default)
=> client.QueryRequiredSingleAsync<CreateUserResult>(
Query, new Dictionary<string, object?>() { { "name", name }, { "email", email } },
capabilities: Capabilities.Modifications, token: token
);

/// <summary>
/// Executes the CreateUser query, defined as:
/// <code>
/// INSERT Person {
/// name := &lt;str&gt;$name,
/// email := &lt;str&gt;$email
/// }
/// UNLESS CONFLICT ON .email
/// ELSE (SELECT Person)
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="name">The name parameter in the query.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<CreateUserResult> CreateUserAsync(this IEdgeDBQueryable client, String name, String email, CancellationToken token = default)
=> ExecuteAsync(client, name, email, token: token);
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// AUTOGENERATED: DO NOT MODIFY
// edgeql:8F4282FFB3ADCA549B2F18362FAE328971409954B3CFA1B28AD5CCE1F74156AC
// Generated on 2023-07-24T15:15:21.9231397Z
#nullable enable
using EdgeDB;
using EdgeDB.DataTypes;

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace EdgeDB.Generated;

public static class DeleteUser
{
/// <summary>
/// The string containing the query defined in <c>C:\Users\lynch\source\repos\EdgeDB\examples\EdgeDB.Examples.GenerationExample\Scripts\DeleteUser.edgeql</c>.
/// </summary>
public static readonly string Query;
private static readonly string _queryHex = "44454C45544520506572736F6E200D0A46494C544552202E656D61696C203D203C7374723E24656D61696C";


static DeleteUser()
{
Query = string.Join("", Regex.Split(_queryHex, "(?<=\\G..)(?!$)").Select(x => (char)Convert.ToByte(x, 16)));
}

/// <summary>
/// Executes the DeleteUser query, defined as:
/// <code>
/// DELETE Person
/// FILTER .email = &lt;str&gt;$email
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<DeleteUserResult?> ExecuteAsync(IEdgeDBQueryable client, String email, CancellationToken token = default)
=> client.QuerySingleAsync<DeleteUserResult>(
Query, new Dictionary<string, object?>() { { "email", email } },
capabilities: Capabilities.Modifications, token: token
);

/// <summary>
/// Executes the DeleteUser query, defined as:
/// <code>
/// DELETE Person
/// FILTER .email = &lt;str&gt;$email
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<DeleteUserResult?> DeleteUserAsync(this IEdgeDBQueryable client, String email, CancellationToken token = default)
=> ExecuteAsync(client, email, token: token);
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EdgeDB.Net.Driver" Version="1.2.2" />
</ItemGroup>

<ItemGroup>
<Folder Include="Results\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// AUTOGENERATED: DO NOT MODIFY
// edgeql:C2792288AE6845E4B2E4B3324315537B82E7715A9114BEFF57A1DCC479448C78
// Generated on 2023-07-24T15:15:21.9473062Z
#nullable enable
using EdgeDB;
using EdgeDB.DataTypes;

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace EdgeDB.Generated;

public static class GetUser
{
/// <summary>
/// The string containing the query defined in <c>C:\Users\lynch\source\repos\EdgeDB\examples\EdgeDB.Examples.GenerationExample\Scripts\GetUser.edgeql</c>.
/// </summary>
public static readonly string Query;
private static readonly string _queryHex = "53454C45435420506572736F6E207B0D0A096E616D652C20656D61696C0D0A7D0D0A46494C544552202E656D61696C203D203C7374723E24656D61696C";


static GetUser()
{
Query = string.Join("", Regex.Split(_queryHex, "(?<=\\G..)(?!$)").Select(x => (char)Convert.ToByte(x, 16)));
}

/// <summary>
/// Executes the GetUser query, defined as:
/// <code>
/// SELECT Person {
/// name, email
/// }
/// FILTER .email = &lt;str&gt;$email
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<GetUserResult?> ExecuteAsync(IEdgeDBQueryable client, String email, CancellationToken token = default)
=> client.QuerySingleAsync<GetUserResult>(
Query, new Dictionary<string, object?>() { { "email", email } },
capabilities: Capabilities.ReadOnly, token: token
);

/// <summary>
/// Executes the GetUser query, defined as:
/// <code>
/// SELECT Person {
/// name, email
/// }
/// FILTER .email = &lt;str&gt;$email
/// </code>
/// </summary>
/// <param name="client">The client to execute the query on.</param>
/// <param name="email">The email parameter in the query.</param>
public static Task<GetUserResult?> GetUserAsync(this IEdgeDBQueryable client, String email, CancellationToken token = default)
=> ExecuteAsync(client, email, token: token);
}
#nullable restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using EdgeDB;
using EdgeDB.DataTypes;
using System;

#nullable enable
#pragma warning disable CS8618 // nullablility is controlled by EdgeDB

namespace EdgeDB.Generated;

[EdgeDBType]
public sealed class CreateUserResult
{
[EdgeDBProperty("id")]
public Guid Id { get; set; }

}

#nullable restore
#pragma warning restore CS8618
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using EdgeDB;
using EdgeDB.DataTypes;
using System;

#nullable enable
#pragma warning disable CS8618 // nullablility is controlled by EdgeDB

namespace EdgeDB.Generated;

[EdgeDBType]
public sealed class DeleteUserResult
{
[EdgeDBProperty("id")]
public Guid Id { get; set; }

}

#nullable restore
#pragma warning restore CS8618
Loading