-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite C# codegen to the new Lang infra + fixes (#220)
## Description of Changes This is the companion PR for clockworklabs/SpacetimeDB#2184, please see the other PR for full description. On the client side main changes are: - Regenerate .NET and Unity test client bindings and test snapshot. - Remove `IDatabaseRow` since V9 multi-tables splits data types from actual table definitions, so those "table data types" are no longer special. Just using `IStructuralReadWrite` in its place now. - Add base index classes as mentioned in the other PR. - As a sub-improvement, the non-unique index class actually does indexing instead of iterating over the entire table like we did before. - Remove internal-but-not-really `InternalInvokeValueDeleted` and `InternalInvokeValueInserted` methods in favour of private events. ## API - [x] This is an API breaking change to the SDK Removes some technically-visible but internal APIs. ## Requires SpacetimeDB PRs clockworklabs/SpacetimeDB#2184 ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: ingvar/csharp-new-codegen ## Testing *Write instructions for a test that you performed for this PR* - [x] Manually tested Blackholio --------- Co-authored-by: James Gilles <[email protected]>
- Loading branch information
Showing
113 changed files
with
1,763 additions
and
1,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Quickstart client | ||
See [SpacetimeDB](https://github.com/clockworklabs/SpacetimeDB)/modules/quickstart-chat | ||
|
||
## Regenerating bindings | ||
|
||
To regenerate bindings: clone SpacetimeDB next to this repo, then in the root of this repo: | ||
|
||
```bash | ||
tools~/gen-quickstart.sh ../SpacetimeDB | ||
``` |
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
examples~/quickstart/client/module_bindings/Reducers/IdentityConnected.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE | ||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB.ClientApi; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace SpacetimeDB.Types | ||
{ | ||
public sealed partial class RemoteReducers : RemoteBase | ||
{ | ||
public delegate void IdentityConnectedHandler(EventContext ctx); | ||
public event IdentityConnectedHandler? OnIdentityConnected; | ||
|
||
public bool InvokeIdentityConnected(EventContext ctx, Reducer.IdentityConnected args) | ||
{ | ||
if (OnIdentityConnected == null) return false; | ||
OnIdentityConnected( | ||
ctx | ||
); | ||
return true; | ||
} | ||
} | ||
|
||
public abstract partial class Reducer | ||
{ | ||
[SpacetimeDB.Type] | ||
[DataContract] | ||
public sealed partial class IdentityConnected : Reducer, IReducerArgs | ||
{ | ||
string IReducerArgs.ReducerName => "identity_connected"; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
examples~/quickstart/client/module_bindings/Reducers/IdentityDisconnected.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE | ||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB.ClientApi; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace SpacetimeDB.Types | ||
{ | ||
public sealed partial class RemoteReducers : RemoteBase | ||
{ | ||
public delegate void IdentityDisconnectedHandler(EventContext ctx); | ||
public event IdentityDisconnectedHandler? OnIdentityDisconnected; | ||
|
||
public bool InvokeIdentityDisconnected(EventContext ctx, Reducer.IdentityDisconnected args) | ||
{ | ||
if (OnIdentityDisconnected == null) return false; | ||
OnIdentityDisconnected( | ||
ctx | ||
); | ||
return true; | ||
} | ||
} | ||
|
||
public abstract partial class Reducer | ||
{ | ||
[SpacetimeDB.Type] | ||
[DataContract] | ||
public sealed partial class IdentityDisconnected : Reducer, IReducerArgs | ||
{ | ||
string IReducerArgs.ReducerName => "identity_disconnected"; | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
examples~/quickstart/client/module_bindings/Reducers/SendMessage.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE | ||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB.ClientApi; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace SpacetimeDB.Types | ||
{ | ||
public sealed partial class RemoteReducers : RemoteBase | ||
{ | ||
public delegate void SendMessageHandler(EventContext ctx, string text); | ||
public event SendMessageHandler? OnSendMessage; | ||
|
||
public void SendMessage(string text) | ||
{ | ||
conn.InternalCallReducer(new Reducer.SendMessage(text), this.SetCallReducerFlags.SendMessageFlags); | ||
} | ||
|
||
public bool InvokeSendMessage(EventContext ctx, Reducer.SendMessage args) | ||
{ | ||
if (OnSendMessage == null) return false; | ||
OnSendMessage( | ||
ctx, | ||
args.Text | ||
); | ||
return true; | ||
} | ||
} | ||
|
||
public abstract partial class Reducer | ||
{ | ||
[SpacetimeDB.Type] | ||
[DataContract] | ||
public sealed partial class SendMessage : Reducer, IReducerArgs | ||
{ | ||
[DataMember(Name = "text")] | ||
public string Text; | ||
|
||
public SendMessage(string Text) | ||
{ | ||
this.Text = Text; | ||
} | ||
|
||
public SendMessage() | ||
{ | ||
this.Text = ""; | ||
} | ||
|
||
string IReducerArgs.ReducerName => "send_message"; | ||
} | ||
} | ||
|
||
public sealed partial class SetReducerFlags | ||
{ | ||
internal CallReducerFlags SendMessageFlags; | ||
public void SendMessage(CallReducerFlags flags) => SendMessageFlags = flags; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
examples~/quickstart/client/module_bindings/Reducers/SetName.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE | ||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB.ClientApi; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace SpacetimeDB.Types | ||
{ | ||
public sealed partial class RemoteReducers : RemoteBase | ||
{ | ||
public delegate void SetNameHandler(EventContext ctx, string name); | ||
public event SetNameHandler? OnSetName; | ||
|
||
public void SetName(string name) | ||
{ | ||
conn.InternalCallReducer(new Reducer.SetName(name), this.SetCallReducerFlags.SetNameFlags); | ||
} | ||
|
||
public bool InvokeSetName(EventContext ctx, Reducer.SetName args) | ||
{ | ||
if (OnSetName == null) return false; | ||
OnSetName( | ||
ctx, | ||
args.Name | ||
); | ||
return true; | ||
} | ||
} | ||
|
||
public abstract partial class Reducer | ||
{ | ||
[SpacetimeDB.Type] | ||
[DataContract] | ||
public sealed partial class SetName : Reducer, IReducerArgs | ||
{ | ||
[DataMember(Name = "name")] | ||
public string Name; | ||
|
||
public SetName(string Name) | ||
{ | ||
this.Name = Name; | ||
} | ||
|
||
public SetName() | ||
{ | ||
this.Name = ""; | ||
} | ||
|
||
string IReducerArgs.ReducerName => "set_name"; | ||
} | ||
} | ||
|
||
public sealed partial class SetReducerFlags | ||
{ | ||
internal CallReducerFlags SetNameFlags; | ||
public void SetName(CallReducerFlags flags) => SetNameFlags = flags; | ||
} | ||
} |
Oops, something went wrong.