--- source: crates/codegen/tests/codegen.rs assertion_line: 37 expression: outfiles --- "Procedures/GetMySchemaViaHttp.g.cs" = ''' // 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 { public sealed partial class RemoteProcedures : RemoteBase { public void GetMySchemaViaHttp(ProcedureCallback callback) { // Convert the clean callback to the wrapper callback InternalGetMySchemaViaHttp((ctx, result) => { if (result.IsSuccess && result.Value != null) { callback(ctx, ProcedureCallbackResult.Success(result.Value.Value)); } else { callback(ctx, ProcedureCallbackResult.Failure(result.Error!)); } }); } private void InternalGetMySchemaViaHttp(ProcedureCallback callback) { conn.InternalCallProcedure(new Procedure.GetMySchemaViaHttpArgs(), callback); } } public abstract partial class Procedure { [SpacetimeDB.Type] [DataContract] public sealed partial class GetMySchemaViaHttp { [DataMember(Name = "Value")] public string Value; public GetMySchemaViaHttp(string Value) { this.Value = Value; } public GetMySchemaViaHttp() { this.Value = ""; } } [SpacetimeDB.Type] [DataContract] public sealed partial class GetMySchemaViaHttpArgs : Procedure, IProcedureArgs { string IProcedureArgs.ProcedureName => "get_my_schema_via_http"; } } } ''' "Procedures/ReturnValue.g.cs" = ''' // 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 { public sealed partial class RemoteProcedures : RemoteBase { public void ReturnValue(ulong foo, ProcedureCallback callback) { // Convert the clean callback to the wrapper callback InternalReturnValue(foo, (ctx, result) => { if (result.IsSuccess && result.Value != null) { callback(ctx, ProcedureCallbackResult.Success(result.Value.Value)); } else { callback(ctx, ProcedureCallbackResult.Failure(result.Error!)); } }); } private void InternalReturnValue(ulong foo, ProcedureCallback callback) { conn.InternalCallProcedure(new Procedure.ReturnValueArgs(foo), callback); } } public abstract partial class Procedure { [SpacetimeDB.Type] [DataContract] public sealed partial class ReturnValue { [DataMember(Name = "Value")] public SpacetimeDB.Baz Value; public ReturnValue(SpacetimeDB.Baz Value) { this.Value = Value; } public ReturnValue() { this.Value = new(); } } [SpacetimeDB.Type] [DataContract] public sealed partial class ReturnValueArgs : Procedure, IProcedureArgs { [DataMember(Name = "foo")] public ulong Foo; public ReturnValueArgs(ulong Foo) { this.Foo = Foo; } public ReturnValueArgs() { } string IProcedureArgs.ProcedureName => "return_value"; } } } ''' "Procedures/SleepOneSecond.g.cs" = ''' // 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 { public sealed partial class RemoteProcedures : RemoteBase { public void SleepOneSecond(ProcedureCallback callback) { // Convert the clean callback to the wrapper callback InternalSleepOneSecond((ctx, result) => { if (result.IsSuccess && result.Value != null) { callback(ctx, ProcedureCallbackResult.Success(result.Value.Value)); } else { callback(ctx, ProcedureCallbackResult.Failure(result.Error!)); } }); } private void InternalSleepOneSecond(ProcedureCallback callback) { conn.InternalCallProcedure(new Procedure.SleepOneSecondArgs(), callback); } } public abstract partial class Procedure { [SpacetimeDB.Type] [DataContract] public sealed partial class SleepOneSecond { [DataMember(Name = "Value")] public SpacetimeDB.Unit Value; public SleepOneSecond(SpacetimeDB.Unit Value) { this.Value = Value; } public SleepOneSecond() { } } [SpacetimeDB.Type] [DataContract] public sealed partial class SleepOneSecondArgs : Procedure, IProcedureArgs { string IProcedureArgs.ProcedureName => "sleep_one_second"; } } } ''' "Procedures/WithTx.g.cs" = ''' // 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 { public sealed partial class RemoteProcedures : RemoteBase { public void WithTx(ProcedureCallback callback) { // Convert the clean callback to the wrapper callback InternalWithTx((ctx, result) => { if (result.IsSuccess && result.Value != null) { callback(ctx, ProcedureCallbackResult.Success(result.Value.Value)); } else { callback(ctx, ProcedureCallbackResult.Failure(result.Error!)); } }); } private void InternalWithTx(ProcedureCallback callback) { conn.InternalCallProcedure(new Procedure.WithTxArgs(), callback); } } public abstract partial class Procedure { [SpacetimeDB.Type] [DataContract] public sealed partial class WithTx { [DataMember(Name = "Value")] public SpacetimeDB.Unit Value; public WithTx(SpacetimeDB.Unit Value) { this.Value = Value; } public WithTx() { } } [SpacetimeDB.Type] [DataContract] public sealed partial class WithTxArgs : Procedure, IProcedureArgs { string IProcedureArgs.ProcedureName => "with_tx"; } } } ''' "Reducers/Add.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void AddHandler(ReducerEventContext ctx, string name, byte age); public event AddHandler? OnAdd; public void Add(string name, byte age) { conn.InternalCallReducer(new Reducer.Add(name, age)); } public bool InvokeAdd(ReducerEventContext ctx, Reducer.Add args) { if (OnAdd == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnAdd( ctx, args.Name, args.Age ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class Add : Reducer, IReducerArgs { [DataMember(Name = "name")] public string Name; [DataMember(Name = "age")] public byte Age; public Add( string Name, byte Age ) { this.Name = Name; this.Age = Age; } public Add() { this.Name = ""; } string IReducerArgs.ReducerName => "add"; } } } ''' "Reducers/AddPlayer.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void AddPlayerHandler(ReducerEventContext ctx, string name); public event AddPlayerHandler? OnAddPlayer; public void AddPlayer(string name) { conn.InternalCallReducer(new Reducer.AddPlayer(name)); } public bool InvokeAddPlayer(ReducerEventContext ctx, Reducer.AddPlayer args) { if (OnAddPlayer == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnAddPlayer( ctx, args.Name ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class AddPlayer : Reducer, IReducerArgs { [DataMember(Name = "name")] public string Name; public AddPlayer(string Name) { this.Name = Name; } public AddPlayer() { this.Name = ""; } string IReducerArgs.ReducerName => "add_player"; } } } ''' "Reducers/AddPrivate.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void AddPrivateHandler(ReducerEventContext ctx, string name); public event AddPrivateHandler? OnAddPrivate; public void AddPrivate(string name) { conn.InternalCallReducer(new Reducer.AddPrivate(name)); } public bool InvokeAddPrivate(ReducerEventContext ctx, Reducer.AddPrivate args) { if (OnAddPrivate == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnAddPrivate( ctx, args.Name ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class AddPrivate : Reducer, IReducerArgs { [DataMember(Name = "name")] public string Name; public AddPrivate(string Name) { this.Name = Name; } public AddPrivate() { this.Name = ""; } string IReducerArgs.ReducerName => "add_private"; } } } ''' "Reducers/AssertCallerIdentityIsModuleIdentity.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void AssertCallerIdentityIsModuleIdentityHandler(ReducerEventContext ctx); public event AssertCallerIdentityIsModuleIdentityHandler? OnAssertCallerIdentityIsModuleIdentity; public void AssertCallerIdentityIsModuleIdentity() { conn.InternalCallReducer(new Reducer.AssertCallerIdentityIsModuleIdentity()); } public bool InvokeAssertCallerIdentityIsModuleIdentity(ReducerEventContext ctx, Reducer.AssertCallerIdentityIsModuleIdentity args) { if (OnAssertCallerIdentityIsModuleIdentity == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnAssertCallerIdentityIsModuleIdentity( ctx ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class AssertCallerIdentityIsModuleIdentity : Reducer, IReducerArgs { string IReducerArgs.ReducerName => "assert_caller_identity_is_module_identity"; } } } ''' "Reducers/DeletePlayer.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void DeletePlayerHandler(ReducerEventContext ctx, ulong id); public event DeletePlayerHandler? OnDeletePlayer; public void DeletePlayer(ulong id) { conn.InternalCallReducer(new Reducer.DeletePlayer(id)); } public bool InvokeDeletePlayer(ReducerEventContext ctx, Reducer.DeletePlayer args) { if (OnDeletePlayer == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnDeletePlayer( ctx, args.Id ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class DeletePlayer : Reducer, IReducerArgs { [DataMember(Name = "id")] public ulong Id; public DeletePlayer(ulong Id) { this.Id = Id; } public DeletePlayer() { } string IReducerArgs.ReducerName => "delete_player"; } } } ''' "Reducers/DeletePlayersByName.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void DeletePlayersByNameHandler(ReducerEventContext ctx, string name); public event DeletePlayersByNameHandler? OnDeletePlayersByName; public void DeletePlayersByName(string name) { conn.InternalCallReducer(new Reducer.DeletePlayersByName(name)); } public bool InvokeDeletePlayersByName(ReducerEventContext ctx, Reducer.DeletePlayersByName args) { if (OnDeletePlayersByName == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnDeletePlayersByName( ctx, args.Name ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class DeletePlayersByName : Reducer, IReducerArgs { [DataMember(Name = "name")] public string Name; public DeletePlayersByName(string Name) { this.Name = Name; } public DeletePlayersByName() { this.Name = ""; } string IReducerArgs.ReducerName => "delete_players_by_name"; } } } ''' "Reducers/ListOverAge.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void ListOverAgeHandler(ReducerEventContext ctx, byte age); public event ListOverAgeHandler? OnListOverAge; public void ListOverAge(byte age) { conn.InternalCallReducer(new Reducer.ListOverAge(age)); } public bool InvokeListOverAge(ReducerEventContext ctx, Reducer.ListOverAge args) { if (OnListOverAge == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnListOverAge( ctx, args.Age ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class ListOverAge : Reducer, IReducerArgs { [DataMember(Name = "age")] public byte Age; public ListOverAge(byte Age) { this.Age = Age; } public ListOverAge() { } string IReducerArgs.ReducerName => "list_over_age"; } } } ''' "Reducers/LogModuleIdentity.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void LogModuleIdentityHandler(ReducerEventContext ctx); public event LogModuleIdentityHandler? OnLogModuleIdentity; public void LogModuleIdentity() { conn.InternalCallReducer(new Reducer.LogModuleIdentity()); } public bool InvokeLogModuleIdentity(ReducerEventContext ctx, Reducer.LogModuleIdentity args) { if (OnLogModuleIdentity == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnLogModuleIdentity( ctx ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class LogModuleIdentity : Reducer, IReducerArgs { string IReducerArgs.ReducerName => "log_module_identity"; } } } ''' "Reducers/QueryPrivate.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void QueryPrivateHandler(ReducerEventContext ctx); public event QueryPrivateHandler? OnQueryPrivate; public void QueryPrivate() { conn.InternalCallReducer(new Reducer.QueryPrivate()); } public bool InvokeQueryPrivate(ReducerEventContext ctx, Reducer.QueryPrivate args) { if (OnQueryPrivate == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnQueryPrivate( ctx ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class QueryPrivate : Reducer, IReducerArgs { string IReducerArgs.ReducerName => "query_private"; } } } ''' "Reducers/SayHello.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void SayHelloHandler(ReducerEventContext ctx); public event SayHelloHandler? OnSayHello; public void SayHello() { conn.InternalCallReducer(new Reducer.SayHello()); } public bool InvokeSayHello(ReducerEventContext ctx, Reducer.SayHello args) { if (OnSayHello == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnSayHello( ctx ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class SayHello : Reducer, IReducerArgs { string IReducerArgs.ReducerName => "say_hello"; } } } ''' "Reducers/Test.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void TestHandler(ReducerEventContext ctx, SpacetimeDB.TestA arg, SpacetimeDB.TestB arg2, SpacetimeDB.NamespaceTestC arg3, SpacetimeDB.NamespaceTestF arg4); public event TestHandler? OnTest; public void Test(SpacetimeDB.TestA arg, SpacetimeDB.TestB arg2, SpacetimeDB.NamespaceTestC arg3, SpacetimeDB.NamespaceTestF arg4) { conn.InternalCallReducer(new Reducer.Test(arg, arg2, arg3, arg4)); } public bool InvokeTest(ReducerEventContext ctx, Reducer.Test args) { if (OnTest == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnTest( ctx, args.Arg, args.Arg2, args.Arg3, args.Arg4 ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class Test : Reducer, IReducerArgs { [DataMember(Name = "arg")] public TestA Arg; [DataMember(Name = "arg_2")] public TestB Arg2; [DataMember(Name = "arg_3")] public NamespaceTestC Arg3; [DataMember(Name = "arg_4")] public NamespaceTestF Arg4; public Test( TestA Arg, TestB Arg2, NamespaceTestC Arg3, NamespaceTestF Arg4 ) { this.Arg = Arg; this.Arg2 = Arg2; this.Arg3 = Arg3; this.Arg4 = Arg4; } public Test() { this.Arg = new(); this.Arg2 = new(); this.Arg4 = null!; } string IReducerArgs.ReducerName => "test"; } } } ''' "Reducers/TestBtreeIndexArgs.g.cs" = ''' // 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 { public sealed partial class RemoteReducers : RemoteBase { public delegate void TestBtreeIndexArgsHandler(ReducerEventContext ctx); public event TestBtreeIndexArgsHandler? OnTestBtreeIndexArgs; public void TestBtreeIndexArgs() { conn.InternalCallReducer(new Reducer.TestBtreeIndexArgs()); } public bool InvokeTestBtreeIndexArgs(ReducerEventContext ctx, Reducer.TestBtreeIndexArgs args) { if (OnTestBtreeIndexArgs == null) { if (InternalOnUnhandledReducerError != null) { switch(ctx.Event.Status) { case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; } } return false; } OnTestBtreeIndexArgs( ctx ); return true; } } public abstract partial class Reducer { [SpacetimeDB.Type] [DataContract] public sealed partial class TestBtreeIndexArgs : Reducer, IReducerArgs { string IReducerArgs.ReducerName => "test_btree_index_args"; } } } ''' "SpacetimeDBClient.g.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. VERSION_COMMENT #nullable enable using System; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteReducers : RemoteBase { internal RemoteReducers(DbConnection conn) : base(conn) { } internal event Action? InternalOnUnhandledReducerError; } public sealed partial class RemoteProcedures : RemoteBase { internal RemoteProcedures(DbConnection conn) : base(conn) { } } public sealed partial class RemoteTables : RemoteTablesBase { public RemoteTables(DbConnection conn) { AddTable(LoggedOutPlayer = new(conn)); AddTable(MyPlayer = new(conn)); AddTable(Person = new(conn)); AddTable(Player = new(conn)); AddTable(TestD = new(conn)); AddTable(TestF = new(conn)); } } public interface IRemoteDbContext : IDbContext { public event Action? OnUnhandledReducerError; } public sealed class EventContext : IEventContext, IRemoteDbContext { private readonly DbConnection conn; /// /// The event that caused this callback to run. /// public readonly Event Event; /// /// Access to tables in the client cache, which stores a read-only replica of the remote database state. /// /// The returned DbView will have a method to access each table defined by the module. /// public RemoteTables Db => conn.Db; /// /// Access to reducers defined by the module. /// /// The returned RemoteReducers will have a method to invoke each reducer defined by the module, /// plus methods for adding and removing callbacks on each of those reducers. /// public RemoteReducers Reducers => conn.Reducers; /// /// Access to procedures defined by the module. /// /// The returned RemoteProcedures will have a method to invoke each procedure defined by the module, /// with a callback for when the procedure completes and returns a value. /// public RemoteProcedures Procedures => conn.Procedures; /// /// Returns true if the connection is active, i.e. has not yet disconnected. /// public bool IsActive => conn.IsActive; /// /// Close the connection. /// /// Throws an error if the connection is already closed. /// public void Disconnect() { conn.Disconnect(); } /// /// Start building a subscription. /// /// A builder-pattern constructor for subscribing to queries, /// causing matching rows to be replicated into the client cache. public SubscriptionBuilder SubscriptionBuilder() => conn.SubscriptionBuilder(); /// /// Get the Identity of this connection. /// /// This method returns null if the connection was constructed anonymously /// and we have not yet received our newly-generated Identity from the host. /// public Identity? Identity => conn.Identity; /// /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; /// /// Register a callback to be called when a reducer with no handler returns an error. /// public event Action? OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } internal EventContext(DbConnection conn, Event Event) { this.conn = conn; this.Event = Event; } } public sealed class ReducerEventContext : IReducerEventContext, IRemoteDbContext { private readonly DbConnection conn; /// /// The reducer event that caused this callback to run. /// public readonly ReducerEvent Event; /// /// Access to tables in the client cache, which stores a read-only replica of the remote database state. /// /// The returned DbView will have a method to access each table defined by the module. /// public RemoteTables Db => conn.Db; /// /// Access to reducers defined by the module. /// /// The returned RemoteReducers will have a method to invoke each reducer defined by the module, /// plus methods for adding and removing callbacks on each of those reducers. /// public RemoteReducers Reducers => conn.Reducers; /// /// Access to procedures defined by the module. /// /// The returned RemoteProcedures will have a method to invoke each procedure defined by the module, /// with a callback for when the procedure completes and returns a value. /// public RemoteProcedures Procedures => conn.Procedures; /// /// Returns true if the connection is active, i.e. has not yet disconnected. /// public bool IsActive => conn.IsActive; /// /// Close the connection. /// /// Throws an error if the connection is already closed. /// public void Disconnect() { conn.Disconnect(); } /// /// Start building a subscription. /// /// A builder-pattern constructor for subscribing to queries, /// causing matching rows to be replicated into the client cache. public SubscriptionBuilder SubscriptionBuilder() => conn.SubscriptionBuilder(); /// /// Get the Identity of this connection. /// /// This method returns null if the connection was constructed anonymously /// and we have not yet received our newly-generated Identity from the host. /// public Identity? Identity => conn.Identity; /// /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; /// /// Register a callback to be called when a reducer with no handler returns an error. /// public event Action? OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } internal ReducerEventContext(DbConnection conn, ReducerEvent reducerEvent) { this.conn = conn; Event = reducerEvent; } } public sealed class ErrorContext : IErrorContext, IRemoteDbContext { private readonly DbConnection conn; /// /// The Exception that caused this error callback to be run. /// public readonly Exception Event; Exception IErrorContext.Event { get { return Event; } } /// /// Access to tables in the client cache, which stores a read-only replica of the remote database state. /// /// The returned DbView will have a method to access each table defined by the module. /// public RemoteTables Db => conn.Db; /// /// Access to reducers defined by the module. /// /// The returned RemoteReducers will have a method to invoke each reducer defined by the module, /// plus methods for adding and removing callbacks on each of those reducers. /// public RemoteReducers Reducers => conn.Reducers; /// /// Access to procedures defined by the module. /// /// The returned RemoteProcedures will have a method to invoke each procedure defined by the module, /// with a callback for when the procedure completes and returns a value. /// public RemoteProcedures Procedures => conn.Procedures; /// /// Returns true if the connection is active, i.e. has not yet disconnected. /// public bool IsActive => conn.IsActive; /// /// Close the connection. /// /// Throws an error if the connection is already closed. /// public void Disconnect() { conn.Disconnect(); } /// /// Start building a subscription. /// /// A builder-pattern constructor for subscribing to queries, /// causing matching rows to be replicated into the client cache. public SubscriptionBuilder SubscriptionBuilder() => conn.SubscriptionBuilder(); /// /// Get the Identity of this connection. /// /// This method returns null if the connection was constructed anonymously /// and we have not yet received our newly-generated Identity from the host. /// public Identity? Identity => conn.Identity; /// /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; /// /// Register a callback to be called when a reducer with no handler returns an error. /// public event Action? OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } internal ErrorContext(DbConnection conn, Exception error) { this.conn = conn; Event = error; } } public sealed class SubscriptionEventContext : ISubscriptionEventContext, IRemoteDbContext { private readonly DbConnection conn; /// /// Access to tables in the client cache, which stores a read-only replica of the remote database state. /// /// The returned DbView will have a method to access each table defined by the module. /// public RemoteTables Db => conn.Db; /// /// Access to reducers defined by the module. /// /// The returned RemoteReducers will have a method to invoke each reducer defined by the module, /// plus methods for adding and removing callbacks on each of those reducers. /// public RemoteReducers Reducers => conn.Reducers; /// /// Access to procedures defined by the module. /// /// The returned RemoteProcedures will have a method to invoke each procedure defined by the module, /// with a callback for when the procedure completes and returns a value. /// public RemoteProcedures Procedures => conn.Procedures; /// /// Returns true if the connection is active, i.e. has not yet disconnected. /// public bool IsActive => conn.IsActive; /// /// Close the connection. /// /// Throws an error if the connection is already closed. /// public void Disconnect() { conn.Disconnect(); } /// /// Start building a subscription. /// /// A builder-pattern constructor for subscribing to queries, /// causing matching rows to be replicated into the client cache. public SubscriptionBuilder SubscriptionBuilder() => conn.SubscriptionBuilder(); /// /// Get the Identity of this connection. /// /// This method returns null if the connection was constructed anonymously /// and we have not yet received our newly-generated Identity from the host. /// public Identity? Identity => conn.Identity; /// /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; /// /// Register a callback to be called when a reducer with no handler returns an error. /// public event Action? OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } internal SubscriptionEventContext(DbConnection conn) { this.conn = conn; } } public sealed class ProcedureEventContext : IProcedureEventContext, IRemoteDbContext { private readonly DbConnection conn; /// /// The procedure event that caused this callback to run. /// public readonly ProcedureEvent Event; /// /// Access to tables in the client cache, which stores a read-only replica of the remote database state. /// /// The returned DbView will have a method to access each table defined by the module. /// public RemoteTables Db => conn.Db; /// /// Access to reducers defined by the module. /// /// The returned RemoteReducers will have a method to invoke each reducer defined by the module, /// plus methods for adding and removing callbacks on each of those reducers. /// public RemoteReducers Reducers => conn.Reducers; /// /// Access to procedures defined by the module. /// /// The returned RemoteProcedures will have a method to invoke each procedure defined by the module, /// with a callback for when the procedure completes and returns a value. /// public RemoteProcedures Procedures => conn.Procedures; /// /// Returns true if the connection is active, i.e. has not yet disconnected. /// public bool IsActive => conn.IsActive; /// /// Close the connection. /// /// Throws an error if the connection is already closed. /// public void Disconnect() { conn.Disconnect(); } /// /// Start building a subscription. /// /// A builder-pattern constructor for subscribing to queries, /// causing matching rows to be replicated into the client cache. public SubscriptionBuilder SubscriptionBuilder() => conn.SubscriptionBuilder(); /// /// Get the Identity of this connection. /// /// This method returns null if the connection was constructed anonymously /// and we have not yet received our newly-generated Identity from the host. /// public Identity? Identity => conn.Identity; /// /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; /// /// Register a callback to be called when a reducer with no handler returns an error. /// public event Action? OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } internal ProcedureEventContext(DbConnection conn, ProcedureEvent Event) { this.conn = conn; this.Event = Event; } } /// /// Builder-pattern constructor for subscription queries. /// public sealed class SubscriptionBuilder { private readonly IDbConnection conn; private event Action? Applied; private event Action? Error; /// /// Private API, use conn.SubscriptionBuilder() instead. /// public SubscriptionBuilder(IDbConnection conn) { this.conn = conn; } /// /// Register a callback to run when the subscription is applied. /// public SubscriptionBuilder OnApplied( Action callback ) { Applied += callback; return this; } /// /// Register a callback to run when the subscription fails. /// /// Note that this callback may run either when attempting to apply the subscription, /// in which case Self::on_applied will never run, /// or later during the subscription's lifetime if the module's interface changes, /// in which case Self::on_applied may have already run. /// public SubscriptionBuilder OnError( Action callback ) { Error += callback; return this; } /// /// Add a typed query to this subscription. /// /// This is the entry point for building subscriptions without writing SQL by hand. /// Once a typed query is added, only typed queries may follow (SQL and typed queries cannot be mixed). /// public TypedSubscriptionBuilder AddQuery( Func> build ) { var typed = new TypedSubscriptionBuilder(conn, Applied, Error); return typed.AddQuery(build); } /// /// Subscribe to the following SQL queries. /// /// This method returns immediately, with the data not yet added to the DbConnection. /// The provided callbacks will be invoked once the data is returned from the remote server. /// Data from all the provided queries will be returned at the same time. /// /// See the SpacetimeDB SQL docs for more information on SQL syntax: /// https://spacetimedb.com/docs/sql /// public SubscriptionHandle Subscribe( string[] querySqls ) => new(conn, Applied, Error, querySqls); /// /// Subscribe to all rows from all tables. /// /// This method is intended as a convenience /// for applications where client-side memory use and network bandwidth are not concerns. /// Applications where these resources are a constraint /// should register more precise queries via Self.Subscribe /// in order to replicate only the subset of data which the client needs to function. /// /// This method should not be combined with Self.Subscribe on the same DbConnection. /// A connection may either Self.Subscribe to particular queries, /// or Self.SubscribeToAllTables, but not both. /// Attempting to call Self.Subscribe /// on a DbConnection that has previously used Self.SubscribeToAllTables, /// or vice versa, may misbehave in any number of ways, /// including dropping subscriptions, corrupting the client cache, or panicking. /// public SubscriptionHandle SubscribeToAllTables() => new(conn, Applied, Error, QueryBuilder.AllTablesSqlQueries()); } public sealed class SubscriptionHandle : SubscriptionHandleBase { /// /// Internal API. Construct SubscriptionHandles using conn.SubscriptionBuilder. /// public SubscriptionHandle( IDbConnection conn, Action? onApplied, Action? onError, string[] querySqls ) : base(conn, onApplied, onError, querySqls) { } } public sealed class QueryBuilder { public From From { get; } = new(); internal static string[] AllTablesSqlQueries() => new string[] { new QueryBuilder().From.LoggedOutPlayer().ToSql(), new QueryBuilder().From.MyPlayer().ToSql(), new QueryBuilder().From.Person().ToSql(), new QueryBuilder().From.Player().ToSql(), new QueryBuilder().From.TestD().ToSql(), new QueryBuilder().From.TestF().ToSql(), } ; } public sealed class From { public global::SpacetimeDB.Table LoggedOutPlayer() => new("logged_out_player", new LoggedOutPlayerCols("logged_out_player"), new LoggedOutPlayerIxCols("logged_out_player")); public global::SpacetimeDB.Table MyPlayer() => new("my_player", new MyPlayerCols("my_player"), new MyPlayerIxCols("my_player")); public global::SpacetimeDB.Table Person() => new("person", new PersonCols("person"), new PersonIxCols("person")); public global::SpacetimeDB.Table Player() => new("player", new PlayerCols("player"), new PlayerIxCols("player")); public global::SpacetimeDB.Table TestD() => new("test_d", new TestDCols("test_d"), new TestDIxCols("test_d")); public global::SpacetimeDB.Table TestF() => new("test_f", new TestFCols("test_f"), new TestFIxCols("test_f")); } public sealed class TypedSubscriptionBuilder { private readonly IDbConnection conn; private Action? Applied; private Action? Error; private readonly List querySqls = new(); internal TypedSubscriptionBuilder(IDbConnection conn, Action? applied, Action? error) { this.conn = conn; Applied = applied; Error = error; } public TypedSubscriptionBuilder OnApplied(Action callback) { Applied += callback; return this; } public TypedSubscriptionBuilder OnError(Action callback) { Error += callback; return this; } public TypedSubscriptionBuilder AddQuery(Func> build) { var qb = new QueryBuilder(); querySqls.Add(build(qb).ToSql()); return this; } public SubscriptionHandle Subscribe() => new(conn, Applied, Error, querySqls.ToArray()); } public abstract partial class Reducer { private Reducer() { } } public abstract partial class Procedure { private Procedure() { } } public sealed class DbConnection : DbConnectionBase { public override RemoteTables Db { get; } public readonly RemoteReducers Reducers; public readonly RemoteProcedures Procedures; public DbConnection() { Db = new(this); Reducers = new(this); Procedures = new(this); } protected override IEventContext ToEventContext(Event Event) => new EventContext(this, Event); protected override IReducerEventContext ToReducerEventContext(ReducerEvent reducerEvent) => new ReducerEventContext(this, reducerEvent); protected override ISubscriptionEventContext MakeSubscriptionEventContext() => new SubscriptionEventContext(this); protected override IErrorContext ToErrorContext(Exception exception) => new ErrorContext(this, exception); protected override IProcedureEventContext ToProcedureEventContext(ProcedureEvent procedureEvent) => new ProcedureEventContext(this, procedureEvent); protected override bool Dispatch(IReducerEventContext context, Reducer reducer) { var eventContext = (ReducerEventContext)context; return reducer switch { Reducer.Add args => Reducers.InvokeAdd(eventContext, args), Reducer.AddPlayer args => Reducers.InvokeAddPlayer(eventContext, args), Reducer.AddPrivate args => Reducers.InvokeAddPrivate(eventContext, args), Reducer.AssertCallerIdentityIsModuleIdentity args => Reducers.InvokeAssertCallerIdentityIsModuleIdentity(eventContext, args), Reducer.DeletePlayer args => Reducers.InvokeDeletePlayer(eventContext, args), Reducer.DeletePlayersByName args => Reducers.InvokeDeletePlayersByName(eventContext, args), Reducer.ListOverAge args => Reducers.InvokeListOverAge(eventContext, args), Reducer.LogModuleIdentity args => Reducers.InvokeLogModuleIdentity(eventContext, args), Reducer.QueryPrivate args => Reducers.InvokeQueryPrivate(eventContext, args), Reducer.SayHello args => Reducers.InvokeSayHello(eventContext, args), Reducer.Test args => Reducers.InvokeTest(eventContext, args), Reducer.TestBtreeIndexArgs args => Reducers.InvokeTestBtreeIndexArgs(eventContext, args), _ => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}") }; } public SubscriptionBuilder SubscriptionBuilder() => new(this); public event Action OnUnhandledReducerError { add => Reducers.InternalOnUnhandledReducerError += value; remove => Reducers.InternalOnUnhandledReducerError -= value; } } } ''' "Tables/LoggedOutPlayer.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class LoggedOutPlayerHandle : RemoteTableHandle { protected override string RemoteTableName => "logged_out_player"; public sealed class IdentityUniqueIndex : UniqueIndexBase { protected override SpacetimeDB.Identity GetKey(Player row) => row.Identity; public IdentityUniqueIndex(LoggedOutPlayerHandle table) : base(table) { } } public readonly IdentityUniqueIndex Identity; public sealed class NameUniqueIndex : UniqueIndexBase { protected override string GetKey(Player row) => row.Name; public NameUniqueIndex(LoggedOutPlayerHandle table) : base(table) { } } public readonly NameUniqueIndex Name; public sealed class PlayerIdUniqueIndex : UniqueIndexBase { protected override ulong GetKey(Player row) => row.PlayerId; public PlayerIdUniqueIndex(LoggedOutPlayerHandle table) : base(table) { } } public readonly PlayerIdUniqueIndex PlayerId; internal LoggedOutPlayerHandle(DbConnection conn) : base(conn) { Identity = new(this); Name = new(this); PlayerId = new(this); } protected override object GetPrimaryKey(Player row) => row.Identity; } public readonly LoggedOutPlayerHandle LoggedOutPlayer; } public sealed class LoggedOutPlayerCols { public global::SpacetimeDB.Col Identity { get; } public global::SpacetimeDB.Col PlayerId { get; } public global::SpacetimeDB.Col Name { get; } public LoggedOutPlayerCols(string tableName) { Identity = new global::SpacetimeDB.Col(tableName, "identity"); PlayerId = new global::SpacetimeDB.Col(tableName, "player_id"); Name = new global::SpacetimeDB.Col(tableName, "name"); } } public sealed class LoggedOutPlayerIxCols { public global::SpacetimeDB.IxCol Identity { get; } public global::SpacetimeDB.IxCol PlayerId { get; } public global::SpacetimeDB.IxCol Name { get; } public LoggedOutPlayerIxCols(string tableName) { Identity = new global::SpacetimeDB.IxCol(tableName, "identity"); PlayerId = new global::SpacetimeDB.IxCol(tableName, "player_id"); Name = new global::SpacetimeDB.IxCol(tableName, "name"); } } } ''' "Tables/MyPlayer.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class MyPlayerHandle : RemoteTableHandle { protected override string RemoteTableName => "my_player"; internal MyPlayerHandle(DbConnection conn) : base(conn) { } } public readonly MyPlayerHandle MyPlayer; } public sealed class MyPlayerCols { public global::SpacetimeDB.Col Identity { get; } public global::SpacetimeDB.Col PlayerId { get; } public global::SpacetimeDB.Col Name { get; } public MyPlayerCols(string tableName) { Identity = new global::SpacetimeDB.Col(tableName, "identity"); PlayerId = new global::SpacetimeDB.Col(tableName, "player_id"); Name = new global::SpacetimeDB.Col(tableName, "name"); } } public sealed class MyPlayerIxCols { public MyPlayerIxCols(string tableName) { } } } ''' "Tables/Person.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class PersonHandle : RemoteTableHandle { protected override string RemoteTableName => "person"; public sealed class AgeIndex : BTreeIndexBase { protected override byte GetKey(Person row) => row.Age; public AgeIndex(PersonHandle table) : base(table) { } } public readonly AgeIndex Age; public sealed class IdUniqueIndex : UniqueIndexBase { protected override uint GetKey(Person row) => row.Id; public IdUniqueIndex(PersonHandle table) : base(table) { } } public readonly IdUniqueIndex Id; internal PersonHandle(DbConnection conn) : base(conn) { Age = new(this); Id = new(this); } protected override object GetPrimaryKey(Person row) => row.Id; } public readonly PersonHandle Person; } public sealed class PersonCols { public global::SpacetimeDB.Col Id { get; } public global::SpacetimeDB.Col Name { get; } public global::SpacetimeDB.Col Age { get; } public PersonCols(string tableName) { Id = new global::SpacetimeDB.Col(tableName, "id"); Name = new global::SpacetimeDB.Col(tableName, "name"); Age = new global::SpacetimeDB.Col(tableName, "age"); } } public sealed class PersonIxCols { public global::SpacetimeDB.IxCol Id { get; } public global::SpacetimeDB.IxCol Age { get; } public PersonIxCols(string tableName) { Id = new global::SpacetimeDB.IxCol(tableName, "id"); Age = new global::SpacetimeDB.IxCol(tableName, "age"); } } } ''' "Tables/Player.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class PlayerHandle : RemoteTableHandle { protected override string RemoteTableName => "player"; public sealed class IdentityUniqueIndex : UniqueIndexBase { protected override SpacetimeDB.Identity GetKey(Player row) => row.Identity; public IdentityUniqueIndex(PlayerHandle table) : base(table) { } } public readonly IdentityUniqueIndex Identity; public sealed class NameUniqueIndex : UniqueIndexBase { protected override string GetKey(Player row) => row.Name; public NameUniqueIndex(PlayerHandle table) : base(table) { } } public readonly NameUniqueIndex Name; public sealed class PlayerIdUniqueIndex : UniqueIndexBase { protected override ulong GetKey(Player row) => row.PlayerId; public PlayerIdUniqueIndex(PlayerHandle table) : base(table) { } } public readonly PlayerIdUniqueIndex PlayerId; internal PlayerHandle(DbConnection conn) : base(conn) { Identity = new(this); Name = new(this); PlayerId = new(this); } protected override object GetPrimaryKey(Player row) => row.Identity; } public readonly PlayerHandle Player; } public sealed class PlayerCols { public global::SpacetimeDB.Col Identity { get; } public global::SpacetimeDB.Col PlayerId { get; } public global::SpacetimeDB.Col Name { get; } public PlayerCols(string tableName) { Identity = new global::SpacetimeDB.Col(tableName, "identity"); PlayerId = new global::SpacetimeDB.Col(tableName, "player_id"); Name = new global::SpacetimeDB.Col(tableName, "name"); } } public sealed class PlayerIxCols { public global::SpacetimeDB.IxCol Identity { get; } public global::SpacetimeDB.IxCol PlayerId { get; } public global::SpacetimeDB.IxCol Name { get; } public PlayerIxCols(string tableName) { Identity = new global::SpacetimeDB.IxCol(tableName, "identity"); PlayerId = new global::SpacetimeDB.IxCol(tableName, "player_id"); Name = new global::SpacetimeDB.IxCol(tableName, "name"); } } } ''' "Tables/TestD.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class TestDHandle : RemoteTableHandle { protected override string RemoteTableName => "test_d"; internal TestDHandle(DbConnection conn) : base(conn) { } } public readonly TestDHandle TestD; } public sealed class TestDCols { public global::SpacetimeDB.Col TestC { get; } public global::SpacetimeDB.Col> TestCNested { get; } public TestDCols(string tableName) { TestC = new global::SpacetimeDB.Col(tableName, "test_c"); TestCNested = new global::SpacetimeDB.Col>(tableName, "test_c_nested"); } } public sealed class TestDIxCols { public TestDIxCols(string tableName) { } } } ''' "Tables/TestF.g.cs" = ''' // 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.BSATN; using SpacetimeDB.ClientApi; using System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { public sealed partial class RemoteTables { public sealed class TestFHandle : RemoteTableHandle { protected override string RemoteTableName => "test_f"; internal TestFHandle(DbConnection conn) : base(conn) { } } public readonly TestFHandle TestF; } public sealed class TestFCols { public global::SpacetimeDB.Col Field { get; } public TestFCols(string tableName) { Field = new global::SpacetimeDB.Col(tableName, "field"); } } public sealed class TestFIxCols { public TestFIxCols(string tableName) { } } } ''' "Types/Baz.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class Baz { [DataMember(Name = "field")] public string Field; public Baz(string Field) { this.Field = Field; } public Baz() { this.Field = ""; } } } ''' "Types/Foobar.g.cs" = ''' // 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; namespace SpacetimeDB { [SpacetimeDB.Type] public partial record Foobar : SpacetimeDB.TaggedEnum<( Baz Baz, SpacetimeDB.Unit Bar, uint Har )>; } ''' "Types/HasSpecialStuff.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class HasSpecialStuff { [DataMember(Name = "identity")] public SpacetimeDB.Identity Identity; [DataMember(Name = "connection_id")] public SpacetimeDB.ConnectionId ConnectionId; public HasSpecialStuff( SpacetimeDB.Identity Identity, SpacetimeDB.ConnectionId ConnectionId ) { this.Identity = Identity; this.ConnectionId = ConnectionId; } public HasSpecialStuff() { } } } ''' "Types/NamespaceTestC.g.cs" = ''' // 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; namespace SpacetimeDB { [SpacetimeDB.Type] public enum NamespaceTestC { Foo, Bar, } } ''' "Types/NamespaceTestF.g.cs" = ''' // 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; namespace SpacetimeDB { [SpacetimeDB.Type] public partial record NamespaceTestF : SpacetimeDB.TaggedEnum<( SpacetimeDB.Unit Foo, SpacetimeDB.Unit Bar, string Baz )>; } ''' "Types/NonrepeatingTestArg.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class NonrepeatingTestArg { [DataMember(Name = "scheduled_id")] public ulong ScheduledId; [DataMember(Name = "scheduled_at")] public SpacetimeDB.ScheduleAt ScheduledAt; [DataMember(Name = "prev_time")] public SpacetimeDB.Timestamp PrevTime; public NonrepeatingTestArg( ulong ScheduledId, SpacetimeDB.ScheduleAt ScheduledAt, SpacetimeDB.Timestamp PrevTime ) { this.ScheduledId = ScheduledId; this.ScheduledAt = ScheduledAt; this.PrevTime = PrevTime; } public NonrepeatingTestArg() { this.ScheduledAt = null!; } } } ''' "Types/Person.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class Person { [DataMember(Name = "id")] public uint Id; [DataMember(Name = "name")] public string Name; [DataMember(Name = "age")] public byte Age; public Person( uint Id, string Name, byte Age ) { this.Id = Id; this.Name = Name; this.Age = Age; } public Person() { this.Name = ""; } } } ''' "Types/PkMultiIdentity.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class PkMultiIdentity { [DataMember(Name = "id")] public uint Id; [DataMember(Name = "other")] public uint Other; public PkMultiIdentity( uint Id, uint Other ) { this.Id = Id; this.Other = Other; } public PkMultiIdentity() { } } } ''' "Types/Player.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class Player { [DataMember(Name = "identity")] public SpacetimeDB.Identity Identity; [DataMember(Name = "player_id")] public ulong PlayerId; [DataMember(Name = "name")] public string Name; public Player( SpacetimeDB.Identity Identity, ulong PlayerId, string Name ) { this.Identity = Identity; this.PlayerId = PlayerId; this.Name = Name; } public Player() { this.Name = ""; } } } ''' "Types/Point.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class Point { [DataMember(Name = "x")] public long X; [DataMember(Name = "y")] public long Y; public Point( long X, long Y ) { this.X = X; this.Y = Y; } public Point() { } } } ''' "Types/PrivateTable.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class PrivateTable { [DataMember(Name = "name")] public string Name; public PrivateTable(string Name) { this.Name = Name; } public PrivateTable() { this.Name = ""; } } } ''' "Types/RemoveTable.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class RemoveTable { [DataMember(Name = "id")] public uint Id; public RemoveTable(uint Id) { this.Id = Id; } public RemoveTable() { } } } ''' "Types/RepeatingTestArg.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class RepeatingTestArg { [DataMember(Name = "scheduled_id")] public ulong ScheduledId; [DataMember(Name = "scheduled_at")] public SpacetimeDB.ScheduleAt ScheduledAt; [DataMember(Name = "prev_time")] public SpacetimeDB.Timestamp PrevTime; public RepeatingTestArg( ulong ScheduledId, SpacetimeDB.ScheduleAt ScheduledAt, SpacetimeDB.Timestamp PrevTime ) { this.ScheduledId = ScheduledId; this.ScheduledAt = ScheduledAt; this.PrevTime = PrevTime; } public RepeatingTestArg() { this.ScheduledAt = null!; } } } ''' "Types/TestA.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class TestA { [DataMember(Name = "x")] public uint X; [DataMember(Name = "y")] public uint Y; [DataMember(Name = "z")] public string Z; public TestA( uint X, uint Y, string Z ) { this.X = X; this.Y = Y; this.Z = Z; } public TestA() { this.Z = ""; } } } ''' "Types/TestB.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class TestB { [DataMember(Name = "foo")] public string Foo; public TestB(string Foo) { this.Foo = Foo; } public TestB() { this.Foo = ""; } } } ''' "Types/TestD.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class TestD { [DataMember(Name = "test_c")] public NamespaceTestC? TestC; [DataMember(Name = "test_c_nested")] public System.Collections.Generic.List? TestCNested; public TestD( NamespaceTestC? TestC, System.Collections.Generic.List? TestCNested ) { this.TestC = TestC; this.TestCNested = TestCNested; } public TestD() { } } } ''' "Types/TestE.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class TestE { [DataMember(Name = "id")] public ulong Id; [DataMember(Name = "name")] public string Name; public TestE( ulong Id, string Name ) { this.Id = Id; this.Name = Name; } public TestE() { this.Name = ""; } } } ''' "Types/TestFoobar.g.cs" = ''' // 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 System.Collections.Generic; using System.Runtime.Serialization; namespace SpacetimeDB { [SpacetimeDB.Type] [DataContract] public sealed partial class TestFoobar { [DataMember(Name = "field")] public Foobar Field; public TestFoobar(Foobar Field) { this.Field = Field; } public TestFoobar() { this.Field = null!; } } } '''