diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs
index 9064e3f7b3c..af8b40f3f07 100644
--- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs
+++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs
@@ -1,4 +1,4 @@
-//HintName: FFI.cs
+//HintName: FFI.cs
//
#nullable enable
// The runtime already defines SpacetimeDB.Internal.LocalReadOnly in Runtime\Internal\Module.cs as an empty partial type.
@@ -17,7 +17,6 @@ namespace SpacetimeDB
{
public sealed record ReducerContext : DbContext, Internal.IReducerContext
{
- public readonly Identity Sender;
public readonly ConnectionId? ConnectionId;
public readonly Random Rng;
public readonly Timestamp Timestamp;
@@ -29,6 +28,8 @@ public sealed record ReducerContext : DbContext, Internal.IReducerContext
// We need this property to be non-static for parity with client SDK.
public Identity Identity => Internal.IReducerContext.GetIdentity();
+ private readonly Identity _sender;
+
internal ReducerContext(
Identity identity,
ConnectionId? connectionId,
@@ -37,7 +38,7 @@ internal ReducerContext(
AuthCtx? senderAuth = null
)
{
- Sender = identity;
+ _sender = identity;
ConnectionId = connectionId;
Rng = random;
Timestamp = time;
@@ -45,6 +46,11 @@ internal ReducerContext(
CounterUuid = 0;
}
+ ///
+ /// The identity of the client that invoked the reducer.
+ ///
+ public Identity Sender() => _sender;
+
///
/// Create a new random `v4` using the built-in RNG.
///
@@ -209,13 +215,18 @@ public sealed class Local : global::SpacetimeDB.LocalBase
public sealed record ViewContext : DbContext, Internal.IViewContext
{
- public Identity Sender { get; }
+ private readonly Identity _sender;
internal ViewContext(Identity sender, Internal.LocalReadOnly db)
: base(db)
{
- Sender = sender;
+ _sender = sender;
}
+
+ ///
+ /// The identity of the client that invoked the view.
+ ///
+ public Identity Sender() => _sender;
}
public sealed record AnonymousViewContext
diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#FFI.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#FFI.verified.cs
index 11c5b86ea18..24b27497250 100644
--- a/crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#FFI.verified.cs
+++ b/crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#FFI.verified.cs
@@ -1,4 +1,4 @@
-//HintName: FFI.cs
+//HintName: FFI.cs
//
#nullable enable
// The runtime already defines SpacetimeDB.Internal.LocalReadOnly in Runtime\Internal\Module.cs as an empty partial type.
@@ -17,7 +17,6 @@ namespace SpacetimeDB
{
public sealed record ReducerContext : DbContext, Internal.IReducerContext
{
- public readonly Identity Sender;
public readonly ConnectionId? ConnectionId;
public readonly Random Rng;
public readonly Timestamp Timestamp;
@@ -29,6 +28,8 @@ public sealed record ReducerContext : DbContext, Internal.IReducerContext
// We need this property to be non-static for parity with client SDK.
public Identity Identity => Internal.IReducerContext.GetIdentity();
+ private readonly Identity _sender;
+
internal ReducerContext(
Identity identity,
ConnectionId? connectionId,
@@ -37,7 +38,7 @@ internal ReducerContext(
AuthCtx? senderAuth = null
)
{
- Sender = identity;
+ _sender = identity;
ConnectionId = connectionId;
Rng = random;
Timestamp = time;
@@ -45,6 +46,11 @@ internal ReducerContext(
CounterUuid = 0;
}
+ ///
+ /// The identity of the client that invoked the reducer.
+ ///
+ public Identity Sender() => _sender;
+
///
/// Create a new random `v4` using the built-in RNG.
///
@@ -199,13 +205,18 @@ public sealed class Local : global::SpacetimeDB.LocalBase
public sealed record ViewContext : DbContext, Internal.IViewContext
{
- public Identity Sender { get; }
+ private readonly Identity _sender;
internal ViewContext(Identity sender, Internal.LocalReadOnly db)
: base(db)
{
- Sender = sender;
+ _sender = sender;
}
+
+ ///
+ /// The identity of the client that invoked the view.
+ ///
+ public Identity Sender() => _sender;
}
public sealed record AnonymousViewContext
diff --git a/crates/bindings-csharp/Codegen/Module.cs b/crates/bindings-csharp/Codegen/Module.cs
index 93c44cf0c26..d38f6e31bc5 100644
--- a/crates/bindings-csharp/Codegen/Module.cs
+++ b/crates/bindings-csharp/Codegen/Module.cs
@@ -1743,7 +1743,6 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
namespace SpacetimeDB {
public sealed record ReducerContext : DbContext, Internal.IReducerContext {
- public readonly Identity Sender;
public readonly ConnectionId? ConnectionId;
public readonly Random Rng;
public readonly Timestamp Timestamp;
@@ -1753,16 +1752,24 @@ public sealed record ReducerContext : DbContext, Internal.IReducerContext
// We need this property to be non-static for parity with client SDK.
public Identity Identity => Internal.IReducerContext.GetIdentity();
+ private readonly Identity _sender;
+
internal ReducerContext(Identity identity, ConnectionId? connectionId, Random random,
Timestamp time, AuthCtx? senderAuth = null)
{
- Sender = identity;
+ _sender = identity;
ConnectionId = connectionId;
Rng = random;
Timestamp = time;
SenderAuth = senderAuth ?? AuthCtx.BuildFromSystemTables(connectionId, identity);
CounterUuid = 0;
}
+
+ ///
+ /// The identity of the client that invoked the reducer.
+ ///
+ public Identity Sender() => _sender;
+
///
/// Create a new random `v4` using the built-in RNG.
///
@@ -1897,13 +1904,18 @@ public sealed class Local : global::SpacetimeDB.LocalBase {
public sealed record ViewContext : DbContext, Internal.IViewContext
{
- public Identity Sender { get; }
+ private readonly Identity _sender;
internal ViewContext(Identity sender, Internal.LocalReadOnly db)
: base(db)
{
- Sender = sender;
+ _sender = sender;
}
+
+ ///
+ /// The identity of the client that invoked the view.
+ ///
+ public Identity Sender() => _sender;
}
public sealed record AnonymousViewContext : DbContext, Internal.IAnonymousViewContext
diff --git a/crates/bindings-csharp/Runtime/Internal/TxContext.cs b/crates/bindings-csharp/Runtime/Internal/TxContext.cs
index d5bea2febd9..f8465e78d56 100644
--- a/crates/bindings-csharp/Runtime/Internal/TxContext.cs
+++ b/crates/bindings-csharp/Runtime/Internal/TxContext.cs
@@ -9,13 +9,16 @@ public sealed class TxContext(
Random rng
)
{
+ private readonly Identity _sender = sender;
+
public Local Db { get; } = db;
- public Identity Sender { get; } = sender;
public ConnectionId? ConnectionId { get; } = connectionId;
public Timestamp Timestamp { get; } = timestamp;
public AuthCtx SenderAuth { get; } = senderAuth;
public Random Rng { get; } = rng;
+ public Identity Sender() => _sender;
+
public TxContext WithTimestamp(Timestamp ts) =>
- new(Db, Sender, ConnectionId, ts, SenderAuth, Rng);
+ new(Db, _sender, ConnectionId, ts, SenderAuth, Rng);
}
diff --git a/crates/bindings-csharp/Runtime/ProcedureContext.cs b/crates/bindings-csharp/Runtime/ProcedureContext.cs
index 4eb8583b7d5..1b878b8e549 100644
--- a/crates/bindings-csharp/Runtime/ProcedureContext.cs
+++ b/crates/bindings-csharp/Runtime/ProcedureContext.cs
@@ -10,8 +10,11 @@ public abstract class ProcedureContextBase(
Timestamp time
) : Internal.IInternalProcedureContext
{
+ private readonly Identity _sender = sender;
+
+ public Identity Sender() => _sender;
+
public static Identity Identity => Internal.IProcedureContext.GetIdentity();
- public Identity Sender { get; } = sender;
public ConnectionId? ConnectionId { get; } = connectionId;
public Random Rng { get; } = random;
public Timestamp Timestamp { get; private set; } = time;
@@ -47,7 +50,7 @@ public Internal.TxContext EnterTxContext(long timestampMicros)
txContext?.WithTimestamp(timestamp)
?? new Internal.TxContext(
CreateLocal(),
- Sender,
+ _sender,
ConnectionId,
timestamp,
SenderAuth,
@@ -229,8 +232,9 @@ public abstract class ProcedureTxContextBase(Internal.TxContext inner)
internal void Refresh(Internal.TxContext inner) => Inner = inner;
+ public Identity Sender() => Inner.Sender();
+
public LocalBase Db => (LocalBase)Inner.Db;
- public Identity Sender => Inner.Sender;
public ConnectionId? ConnectionId => Inner.ConnectionId;
public Timestamp Timestamp => Inner.Timestamp;
public AuthCtx SenderAuth => Inner.SenderAuth;
diff --git a/crates/cli/src/subcommands/generate.rs b/crates/cli/src/subcommands/generate.rs
index 4e6fb5ec124..2cd26885dc0 100644
--- a/crates/cli/src/subcommands/generate.rs
+++ b/crates/cli/src/subcommands/generate.rs
@@ -5,7 +5,9 @@ use clap::parser::ValueSource;
use clap::Arg;
use clap::ArgAction::Set;
use fs_err as fs;
-use spacetimedb_codegen::{generate, Csharp, Lang, OutputFile, Rust, TypeScript, UnrealCpp, AUTO_GENERATED_PREFIX};
+use spacetimedb_codegen::{
+ generate, private_table_names, Csharp, Lang, OutputFile, Rust, TypeScript, UnrealCpp, AUTO_GENERATED_PREFIX,
+};
use spacetimedb_lib::de::serde::DeserializeWrapper;
use spacetimedb_lib::{sats, RawModuleDef};
use spacetimedb_schema;
@@ -171,6 +173,12 @@ pub async fn exec_ex(
extract_descriptions(&path).context("could not extract schema")?
};
+ // TODO: Update this to work with --include-private once that flag exists.
+ let private_tables = private_table_names(&module);
+ if !private_tables.is_empty() {
+ println!("Skipping private tables during codegen: {}.", private_tables.join(", "));
+ }
+
fs::create_dir_all(out_dir)?;
let mut paths = BTreeSet::new();
diff --git a/crates/codegen/src/csharp.rs b/crates/codegen/src/csharp.rs
index f004d8e8a3d..0be88f55ba3 100644
--- a/crates/codegen/src/csharp.rs
+++ b/crates/codegen/src/csharp.rs
@@ -9,7 +9,7 @@ use super::code_indenter::CodeIndenter;
use super::Lang;
use crate::util::{
collect_case, is_reducer_invokable, iter_indexes, iter_reducers, iter_table_names_and_types,
- print_auto_generated_file_comment, print_auto_generated_version_comment, type_ref_name,
+ print_auto_generated_file_comment, print_auto_generated_version_comment, type_ref_name, CodegenVisibility,
};
use crate::{indent_scope, OutputFile};
use convert_case::{Case, Casing};
@@ -1048,7 +1048,7 @@ impl Lang for Csharp<'_> {
indented_block(&mut output, |output| {
writeln!(output, "public RemoteTables(DbConnection conn)");
indented_block(output, |output| {
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
output,
"AddTable({} = new(conn));",
@@ -1071,7 +1071,7 @@ impl Lang for Csharp<'_> {
writeln!(output, "public sealed class From");
indented_block(&mut output, |output| {
- for (table_name, product_type_ref) in iter_table_names_and_types(module) {
+ for (table_name, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
let method_name = table_name.deref().to_case(Case::Pascal);
let row_type = type_ref_name(module, product_type_ref);
let table_name_lit = format!("{:?}", table_name.deref());
diff --git a/crates/codegen/src/lib.rs b/crates/codegen/src/lib.rs
index 461c2cfc1d4..60bb6b0408c 100644
--- a/crates/codegen/src/lib.rs
+++ b/crates/codegen/src/lib.rs
@@ -12,11 +12,12 @@ pub use self::csharp::Csharp;
pub use self::rust::Rust;
pub use self::typescript::TypeScript;
pub use self::unrealcpp::UnrealCpp;
+pub use util::private_table_names;
pub use util::AUTO_GENERATED_PREFIX;
pub fn generate(module: &ModuleDef, lang: &dyn Lang) -> Vec {
itertools::chain!(
- module.tables().map(|tbl| lang.generate_table_file(module, tbl)),
+ util::iter_tables(module, util::CodegenVisibility::OnlyPublic).map(|tbl| lang.generate_table_file(module, tbl)),
module.views().map(|view| lang.generate_view_file(module, view)),
module.types().flat_map(|typ| lang.generate_type_files(module, typ)),
util::iter_reducers(module).map(|reducer| lang.generate_reducer_file(module, reducer)),
diff --git a/crates/codegen/src/rust.rs b/crates/codegen/src/rust.rs
index 47c8097aa37..a831cd0d7dd 100644
--- a/crates/codegen/src/rust.rs
+++ b/crates/codegen/src/rust.rs
@@ -3,7 +3,7 @@ use super::util::{collect_case, iter_reducers, print_lines, type_ref_name};
use super::Lang;
use crate::util::{
iter_indexes, iter_procedures, iter_table_names_and_types, iter_tables, iter_types, iter_unique_cols, iter_views,
- print_auto_generated_file_comment, print_auto_generated_version_comment,
+ print_auto_generated_file_comment, print_auto_generated_version_comment, CodegenVisibility,
};
use crate::OutputFile;
use convert_case::{Case, Casing};
@@ -1131,7 +1131,7 @@ fn iter_module_names(module: &ModuleDef) -> impl Iterator- + '_ {
itertools::chain!(
iter_types(module).map(|ty| type_module_name(&ty.name)),
iter_reducers(module).map(|r| reducer_module_name(&r.name)),
- iter_tables(module).map(|tbl| table_module_name(&tbl.name)),
+ iter_tables(module, CodegenVisibility::OnlyPublic).map(|tbl| table_module_name(&tbl.name)),
iter_views(module).map(|view| table_module_name(&view.name)),
iter_procedures(module).map(|proc| procedure_module_name(&proc.name)),
)
@@ -1151,7 +1151,7 @@ fn print_module_reexports(module: &ModuleDef, out: &mut Indenter) {
let type_name = collect_case(Case::Pascal, ty.name.name_segments());
writeln!(out, "pub use {mod_name}::{type_name};")
}
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
let mod_name = table_module_name(table_name);
// TODO: More precise reexport: we want:
// - The trait name.
@@ -1310,7 +1310,7 @@ fn print_db_update_defn(module: &ModuleDef, out: &mut Indenter) {
out.delimited_block(
"pub struct DbUpdate {",
|out| {
- for (table_name, product_type_ref) in iter_table_names_and_types(module) {
+ for (table_name, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
out,
"{}: __sdk::TableUpdate<{}>,",
@@ -1334,7 +1334,7 @@ impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
match &table_update.table_name[..] {
",
|out| {
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
out,
"{:?} => db_update.{}.append({}::parse_table_update(table_update)?),",
@@ -1378,7 +1378,7 @@ impl __sdk::InModule for DbUpdate {{
let mut diff = AppliedDiff::default();
",
|out| {
- for table in iter_tables(module) {
+ for table in iter_tables(module, CodegenVisibility::OnlyPublic) {
let with_updates = table
.primary_key
.map(|col| {
@@ -1421,7 +1421,7 @@ fn print_applied_diff_defn(module: &ModuleDef, out: &mut Indenter) {
out.delimited_block(
"pub struct AppliedDiff<'r> {",
|out| {
- for (table_name, product_type_ref) in iter_table_names_and_types(module) {
+ for (table_name, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
out,
"{}: __sdk::TableAppliedDiff<'r, {}>,",
@@ -1454,7 +1454,7 @@ impl __sdk::InModule for AppliedDiff<'_> {{
out.delimited_block(
"fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks) {",
|out| {
- for (table_name, product_type_ref) in iter_table_names_and_types(module) {
+ for (table_name, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
out,
"callbacks.invoke_table_row_callbacks::<{}>({:?}, &self.{}, event);",
@@ -1497,7 +1497,7 @@ type QueryBuilder = __sdk::QueryBuilder;
out.delimited_block(
"fn register_tables(client_cache: &mut __sdk::ClientCache) {",
|out| {
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(out, "{}::register_table(client_cache);", table_module_name(table_name));
}
},
diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs
index e153d756996..1fe1900c3a3 100644
--- a/crates/codegen/src/typescript.rs
+++ b/crates/codegen/src/typescript.rs
@@ -1,6 +1,6 @@
use crate::util::{
is_reducer_invokable, iter_constraints, iter_indexes, iter_procedures, iter_reducers, iter_table_names_and_types,
- iter_tables, iter_types, iter_views, print_auto_generated_version_comment,
+ iter_tables, iter_types, iter_views, print_auto_generated_version_comment, CodegenVisibility,
};
use crate::OutputFile;
@@ -231,7 +231,7 @@ impl Lang for TypeScript {
writeln!(out);
writeln!(out, "// Import and reexport all table handle types");
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
let table_module_name = table_module_name(table_name);
let table_name_pascalcase = table_name.deref().to_case(Case::Pascal);
// TODO: This really shouldn't be necessary. We could also have `table()` accept
@@ -253,7 +253,7 @@ impl Lang for TypeScript {
writeln!(out, "/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */");
writeln!(out, "const tablesSchema = __schema(");
out.indent(1);
- for table in iter_tables(module) {
+ for table in iter_tables(module, CodegenVisibility::OnlyPublic) {
let type_ref = table.product_type_ref;
let table_name_pascalcase = table.name.deref().to_case(Case::Pascal);
writeln!(out, "__table({{");
diff --git a/crates/codegen/src/unrealcpp.rs b/crates/codegen/src/unrealcpp.rs
index 0baa6adbc81..22187ecc26a 100644
--- a/crates/codegen/src/unrealcpp.rs
+++ b/crates/codegen/src/unrealcpp.rs
@@ -1,8 +1,8 @@
//! Autogenerated Unreal‑C++ code‑gen backend for SpacetimeDB CLI
use crate::code_indenter::CodeIndenter;
use crate::util::{
- collect_case, fmt_fn, iter_table_names_and_types, print_auto_generated_file_comment,
- print_auto_generated_version_comment,
+ collect_case, fmt_fn, iter_table_names_and_types, iter_tables, print_auto_generated_file_comment,
+ print_auto_generated_version_comment, CodegenVisibility,
};
use crate::util::{iter_indexes, iter_procedures, iter_reducers};
use crate::Lang;
@@ -865,7 +865,7 @@ impl Lang for UnrealCpp<'_> {
writeln!(client_h);
writeln!(client_h, "/** Forward declaration for tables */");
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(client_h, "class U{}Table;", table_name.deref().to_case(Case::Pascal));
}
writeln!(client_h, "/***/");
@@ -958,7 +958,7 @@ impl Lang for UnrealCpp<'_> {
});
// Build table includes
- let table_includes: Vec = iter_table_names_and_types(module)
+ let table_includes: Vec = iter_table_names_and_types(module, CodegenVisibility::OnlyPublic)
.map(|(table_name, _)| {
format!(
"ModuleBindings/Tables/{}Table.g.h",
@@ -987,7 +987,7 @@ impl Lang for UnrealCpp<'_> {
});
// Generate .cpp implementation files for each table
- for table in module.tables() {
+ for table in iter_tables(module, CodegenVisibility::OnlyPublic) {
let schema = TableSchema::from_module_def(module, table, (), 0.into())
.validated()
.expect("table schema should validate");
@@ -2349,7 +2349,7 @@ fn generate_remote_tables_class(output: &mut UnrealCppAutogen, module: &ModuleDe
writeln!(output);
// Generate table handle properties
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(output, " UPROPERTY(BlueprintReadOnly, Category=\"SpacetimeDB\")");
writeln!(
output,
@@ -3023,7 +3023,7 @@ fn generate_client_implementation(output: &mut UnrealCppAutogen, module: &Module
writeln!(output, "\tProcedures->Conn = this;");
writeln!(output);
- for (table_name, product_type_ref) in iter_table_names_and_types(module) {
+ for (table_name, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
let struct_name = type_ref_name(module, product_type_ref);
let table_name = table_name.deref();
writeln!(
@@ -3079,7 +3079,7 @@ fn generate_client_implementation(output: &mut UnrealCppAutogen, module: &Module
writeln!(output, "{{");
writeln!(output);
writeln!(output, "\t/** Creating tables */");
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
output,
"\t{} = NewObject(this);",
@@ -3090,7 +3090,7 @@ fn generate_client_implementation(output: &mut UnrealCppAutogen, module: &Module
writeln!(output, "\t/**/");
writeln!(output);
writeln!(output, "\t/** Initialization */");
- for (table_name, _) in iter_table_names_and_types(module) {
+ for (table_name, _) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
writeln!(
output,
"\t{}->PostInitialize();",
@@ -3980,7 +3980,7 @@ fn collect_wrapper_types(module: &ModuleDef) -> (HashSet, HashSet<(Strin
}
// Collect from all tables
- for (_, product_type_ref) in iter_table_names_and_types(module) {
+ for (_, product_type_ref) in iter_table_names_and_types(module, CodegenVisibility::OnlyPublic) {
let product_type = module.typespace_for_generate()[product_type_ref].as_product().unwrap();
for (_, field_ty) in &product_type.elements {
collect_from_type(module, field_ty, &mut optional_types, &mut result_types);
diff --git a/crates/codegen/src/util.rs b/crates/codegen/src/util.rs
index bc98458ea01..76fd995925f 100644
--- a/crates/codegen/src/util.rs
+++ b/crates/codegen/src/util.rs
@@ -8,6 +8,7 @@ use std::{
use super::code_indenter::Indenter;
use convert_case::{Case, Casing};
use itertools::Itertools;
+use spacetimedb_lib::db::raw_def::v9::TableAccess;
use spacetimedb_lib::sats::layout::PrimitiveType;
use spacetimedb_lib::version;
use spacetimedb_lib::{db::raw_def::v9::Lifecycle, sats::AlgebraicTypeRef};
@@ -27,6 +28,13 @@ use spacetimedb_schema::{
type_for_generate::AlgebraicTypeUse,
};
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub(super) enum CodegenVisibility {
+ #[allow(unused)] // reserved for upcoming change for --include-private option
+ IncludePrivate,
+ OnlyPublic,
+}
+
/// Turns a closure `f: Fn(&mut Formatter) -> Result` into `fmt::Display`.
pub(super) fn fmt_fn(f: impl Fn(&mut Formatter) -> Result) -> impl Display {
struct FDisplay(F);
@@ -123,8 +131,24 @@ pub(super) fn iter_procedures(module: &ModuleDef) -> impl Iterator
- impl Iterator
- {
- module.tables().sorted_by_key(|table| &table.name)
+pub(super) fn iter_tables(module: &ModuleDef, visibility: CodegenVisibility) -> impl Iterator
- {
+ module
+ .tables()
+ .filter(move |table| match visibility {
+ CodegenVisibility::IncludePrivate => true,
+ CodegenVisibility::OnlyPublic => table.table_access == TableAccess::Public,
+ })
+ .sorted_by_key(|table| &table.name)
+}
+
+/// Return the names of all private tables, in alphabetical order.
+pub fn private_table_names(module: &ModuleDef) -> Vec {
+ module
+ .tables()
+ .filter(|table| table.table_access == TableAccess::Private)
+ .sorted_by_key(|table| &table.name)
+ .map(|table| table.name.to_string())
+ .collect()
}
/// Iterate over all the [`ViewDef`]s defined by the module, in alphabetical order by name.
@@ -137,9 +161,16 @@ pub(super) fn iter_views(module: &ModuleDef) -> impl Iterator
- {
/// Iterate over the names of all the tables and views defined by the module, in alphabetical order.
///
/// Sorting is necessary to have deterministic reproducible codegen.
-pub(super) fn iter_table_names_and_types(module: &ModuleDef) -> impl Iterator
- {
+pub(super) fn iter_table_names_and_types(
+ module: &ModuleDef,
+ visibility: CodegenVisibility,
+) -> impl Iterator
- {
module
.tables()
+ .filter(move |table| match visibility {
+ CodegenVisibility::IncludePrivate => true,
+ CodegenVisibility::OnlyPublic => table.table_access == TableAccess::Public,
+ })
.map(|def| (&def.name, def.product_type_ref))
.chain(module.views().map(|def| (&def.name, def.product_type_ref)))
.sorted_by_key(|(name, _)| *name)
diff --git a/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap b/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap
index 626a43853f6..13bc20e37e1 100644
--- a/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap
+++ b/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap
@@ -1161,19 +1161,11 @@ namespace SpacetimeDB
{
public RemoteTables(DbConnection conn)
{
- AddTable(HasSpecialStuff = new(conn));
AddTable(LoggedOutPlayer = new(conn));
AddTable(MyPlayer = new(conn));
AddTable(Person = new(conn));
- AddTable(PkMultiIdentity = new(conn));
AddTable(Player = new(conn));
- AddTable(Points = new(conn));
- AddTable(PrivateTable = new(conn));
- AddTable(RepeatingTestArg = new(conn));
- AddTable(TableToRemove = new(conn));
- AddTable(TestA = new(conn));
AddTable(TestD = new(conn));
- AddTable(TestE = new(conn));
AddTable(TestF = new(conn));
}
}
@@ -1713,19 +1705,11 @@ namespace SpacetimeDB
public sealed class From
{
- public global::SpacetimeDB.Table HasSpecialStuff() => new("has_special_stuff", new HasSpecialStuffCols("has_special_stuff"), new HasSpecialStuffIxCols("has_special_stuff"));
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 PkMultiIdentity() => new("pk_multi_identity", new PkMultiIdentityCols("pk_multi_identity"), new PkMultiIdentityIxCols("pk_multi_identity"));
public global::SpacetimeDB.Table Player() => new("player", new PlayerCols("player"), new PlayerIxCols("player"));
- public global::SpacetimeDB.Table Points() => new("points", new PointsCols("points"), new PointsIxCols("points"));
- public global::SpacetimeDB.Table PrivateTable() => new("private_table", new PrivateTableCols("private_table"), new PrivateTableIxCols("private_table"));
- public global::SpacetimeDB.Table RepeatingTestArg() => new("repeating_test_arg", new RepeatingTestArgCols("repeating_test_arg"), new RepeatingTestArgIxCols("repeating_test_arg"));
- public global::SpacetimeDB.Table TableToRemove() => new("table_to_remove", new TableToRemoveCols("table_to_remove"), new TableToRemoveIxCols("table_to_remove"));
- public global::SpacetimeDB.Table TestA() => new("test_a", new TestACols("test_a"), new TestAIxCols("test_a"));
public global::SpacetimeDB.Table TestD() => new("test_d", new TestDCols("test_d"), new TestDIxCols("test_d"));
- public global::SpacetimeDB.Table TestE() => new("test_e", new TestECols("test_e"), new TestEIxCols("test_e"));
public global::SpacetimeDB.Table TestF() => new("test_f", new TestFCols("test_f"), new TestFIxCols("test_f"));
}
@@ -1854,55 +1838,6 @@ namespace SpacetimeDB
}
}
'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class HasSpecialStuffHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "has_special_stuff";
-
- internal HasSpecialStuffHandle(DbConnection conn) : base(conn)
- {
- }
- }
-
- public readonly HasSpecialStuffHandle HasSpecialStuff;
- }
-
- public sealed class HasSpecialStuffCols
- {
- public global::SpacetimeDB.Col Identity { get; }
- public global::SpacetimeDB.Col ConnectionId { get; }
-
- public HasSpecialStuffCols(string tableName)
- {
- Identity = new global::SpacetimeDB.Col(tableName, "identity");
- ConnectionId = new global::SpacetimeDB.Col(tableName, "connection_id");
- }
- }
-
- public sealed class HasSpecialStuffIxCols
- {
-
- public HasSpecialStuffIxCols(string tableName)
- {
- }
- }
-}
-'''
"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.
@@ -2120,81 +2055,6 @@ namespace SpacetimeDB
}
}
'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class PkMultiIdentityHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "pk_multi_identity";
-
- public sealed class IdUniqueIndex : UniqueIndexBase
- {
- protected override uint GetKey(PkMultiIdentity row) => row.Id;
-
- public IdUniqueIndex(PkMultiIdentityHandle table) : base(table) { }
- }
-
- public readonly IdUniqueIndex Id;
-
- public sealed class OtherUniqueIndex : UniqueIndexBase
- {
- protected override uint GetKey(PkMultiIdentity row) => row.Other;
-
- public OtherUniqueIndex(PkMultiIdentityHandle table) : base(table) { }
- }
-
- public readonly OtherUniqueIndex Other;
-
- internal PkMultiIdentityHandle(DbConnection conn) : base(conn)
- {
- Id = new(this);
- Other = new(this);
- }
-
- protected override object GetPrimaryKey(PkMultiIdentity row) => row.Id;
- }
-
- public readonly PkMultiIdentityHandle PkMultiIdentity;
- }
-
- public sealed class PkMultiIdentityCols
- {
- public global::SpacetimeDB.Col Id { get; }
- public global::SpacetimeDB.Col Other { get; }
-
- public PkMultiIdentityCols(string tableName)
- {
- Id = new global::SpacetimeDB.Col(tableName, "id");
- Other = new global::SpacetimeDB.Col(tableName, "other");
- }
- }
-
- public sealed class PkMultiIdentityIxCols
- {
- public global::SpacetimeDB.IxCol Id { get; }
- public global::SpacetimeDB.IxCol Other { get; }
-
- public PkMultiIdentityIxCols(string tableName)
- {
- Id = new global::SpacetimeDB.IxCol(tableName, "id");
- Other = new global::SpacetimeDB.IxCol(tableName, "other");
- }
- }
-}
-'''
"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.
@@ -2284,291 +2144,6 @@ namespace SpacetimeDB
}
}
'''
-"Tables/Points.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 PointsHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "points";
-
- public sealed class MultiColumnIndexIndex : BTreeIndexBase<(long X, long Y)>
- {
- protected override (long X, long Y) GetKey(Point row) => (row.X, row.Y);
-
- public MultiColumnIndexIndex(PointsHandle table) : base(table) { }
- }
-
- public readonly MultiColumnIndexIndex MultiColumnIndex;
-
- internal PointsHandle(DbConnection conn) : base(conn)
- {
- MultiColumnIndex = new(this);
- }
- }
-
- public readonly PointsHandle Points;
- }
-
- public sealed class PointsCols
- {
- public global::SpacetimeDB.Col X { get; }
- public global::SpacetimeDB.Col Y { get; }
-
- public PointsCols(string tableName)
- {
- X = new global::SpacetimeDB.Col(tableName, "x");
- Y = new global::SpacetimeDB.Col(tableName, "y");
- }
- }
-
- public sealed class PointsIxCols
- {
- public global::SpacetimeDB.IxCol X { get; }
- public global::SpacetimeDB.IxCol Y { get; }
-
- public PointsIxCols(string tableName)
- {
- X = new global::SpacetimeDB.IxCol(tableName, "x");
- Y = new global::SpacetimeDB.IxCol(tableName, "y");
- }
- }
-}
-'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class PrivateTableHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "private_table";
-
- internal PrivateTableHandle(DbConnection conn) : base(conn)
- {
- }
- }
-
- public readonly PrivateTableHandle PrivateTable;
- }
-
- public sealed class PrivateTableCols
- {
- public global::SpacetimeDB.Col Name { get; }
-
- public PrivateTableCols(string tableName)
- {
- Name = new global::SpacetimeDB.Col(tableName, "name");
- }
- }
-
- public sealed class PrivateTableIxCols
- {
-
- public PrivateTableIxCols(string tableName)
- {
- }
- }
-}
-'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class RepeatingTestArgHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "repeating_test_arg";
-
- public sealed class ScheduledIdUniqueIndex : UniqueIndexBase
- {
- protected override ulong GetKey(RepeatingTestArg row) => row.ScheduledId;
-
- public ScheduledIdUniqueIndex(RepeatingTestArgHandle table) : base(table) { }
- }
-
- public readonly ScheduledIdUniqueIndex ScheduledId;
-
- internal RepeatingTestArgHandle(DbConnection conn) : base(conn)
- {
- ScheduledId = new(this);
- }
-
- protected override object GetPrimaryKey(RepeatingTestArg row) => row.ScheduledId;
- }
-
- public readonly RepeatingTestArgHandle RepeatingTestArg;
- }
-
- public sealed class RepeatingTestArgCols
- {
- public global::SpacetimeDB.Col ScheduledId { get; }
- public global::SpacetimeDB.Col ScheduledAt { get; }
- public global::SpacetimeDB.Col PrevTime { get; }
-
- public RepeatingTestArgCols(string tableName)
- {
- ScheduledId = new global::SpacetimeDB.Col(tableName, "scheduled_id");
- ScheduledAt = new global::SpacetimeDB.Col(tableName, "scheduled_at");
- PrevTime = new global::SpacetimeDB.Col(tableName, "prev_time");
- }
- }
-
- public sealed class RepeatingTestArgIxCols
- {
- public global::SpacetimeDB.IxCol ScheduledId { get; }
-
- public RepeatingTestArgIxCols(string tableName)
- {
- ScheduledId = new global::SpacetimeDB.IxCol(tableName, "scheduled_id");
- }
- }
-}
-'''
-"Tables/TableToRemove.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 TableToRemoveHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "table_to_remove";
-
- internal TableToRemoveHandle(DbConnection conn) : base(conn)
- {
- }
- }
-
- public readonly TableToRemoveHandle TableToRemove;
- }
-
- public sealed class TableToRemoveCols
- {
- public global::SpacetimeDB.Col Id { get; }
-
- public TableToRemoveCols(string tableName)
- {
- Id = new global::SpacetimeDB.Col(tableName, "id");
- }
- }
-
- public sealed class TableToRemoveIxCols
- {
-
- public TableToRemoveIxCols(string tableName)
- {
- }
- }
-}
-'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class TestAHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "test_a";
-
- public sealed class FooIndex : BTreeIndexBase
- {
- protected override uint GetKey(TestA row) => row.X;
-
- public FooIndex(TestAHandle table) : base(table) { }
- }
-
- public readonly FooIndex Foo;
-
- internal TestAHandle(DbConnection conn) : base(conn)
- {
- Foo = new(this);
- }
- }
-
- public readonly TestAHandle TestA;
- }
-
- public sealed class TestACols
- {
- public global::SpacetimeDB.Col X { get; }
- public global::SpacetimeDB.Col Y { get; }
- public global::SpacetimeDB.Col Z { get; }
-
- public TestACols(string tableName)
- {
- X = new global::SpacetimeDB.Col(tableName, "x");
- Y = new global::SpacetimeDB.Col(tableName, "y");
- Z = new global::SpacetimeDB.Col(tableName, "z");
- }
- }
-
- public sealed class TestAIxCols
- {
- public global::SpacetimeDB.IxCol X { get; }
-
- public TestAIxCols(string tableName)
- {
- X = new global::SpacetimeDB.IxCol(tableName, "x");
- }
- }
-}
-'''
"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.
@@ -2616,81 +2191,6 @@ namespace SpacetimeDB
}
}
'''
-"Tables/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 SpacetimeDB.BSATN;
-using SpacetimeDB.ClientApi;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace SpacetimeDB
-{
- public sealed partial class RemoteTables
- {
- public sealed class TestEHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "test_e";
-
- public sealed class IdUniqueIndex : UniqueIndexBase
- {
- protected override ulong GetKey(TestE row) => row.Id;
-
- public IdUniqueIndex(TestEHandle table) : base(table) { }
- }
-
- public readonly IdUniqueIndex Id;
-
- public sealed class NameIndex : BTreeIndexBase
- {
- protected override string GetKey(TestE row) => row.Name;
-
- public NameIndex(TestEHandle table) : base(table) { }
- }
-
- public readonly NameIndex Name;
-
- internal TestEHandle(DbConnection conn) : base(conn)
- {
- Id = new(this);
- Name = new(this);
- }
-
- protected override object GetPrimaryKey(TestE row) => row.Id;
- }
-
- public readonly TestEHandle TestE;
- }
-
- public sealed class TestECols
- {
- public global::SpacetimeDB.Col Id { get; }
- public global::SpacetimeDB.Col Name { get; }
-
- public TestECols(string tableName)
- {
- Id = new global::SpacetimeDB.Col(tableName, "id");
- Name = new global::SpacetimeDB.Col(tableName, "name");
- }
- }
-
- public sealed class TestEIxCols
- {
- public global::SpacetimeDB.IxCol Id { get; }
- public global::SpacetimeDB.IxCol Name { get; }
-
- public TestEIxCols(string tableName)
- {
- Id = new global::SpacetimeDB.IxCol(tableName, "id");
- Name = new global::SpacetimeDB.IxCol(tableName, "name");
- }
- }
-}
-'''
"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.
diff --git a/crates/codegen/tests/snapshots/codegen__codegen_rust.snap b/crates/codegen/tests/snapshots/codegen__codegen_rust.snap
index 58508d40a4a..f6d09982fa3 100644
--- a/crates/codegen/tests/snapshots/codegen__codegen_rust.snap
+++ b/crates/codegen/tests/snapshots/codegen__codegen_rust.snap
@@ -771,123 +771,6 @@ impl get_my_schema_via_http for super::RemoteProcedures {
}
}
-'''
-"has_special_stuff_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::has_special_stuff_type::HasSpecialStuff;
-
-/// Table handle for the table `has_special_stuff`.
-///
-/// Obtain a handle from the [`HasSpecialStuffTableAccess::has_special_stuff`] method on [`super::RemoteTables`],
-/// like `ctx.db.has_special_stuff()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.has_special_stuff().on_insert(...)`.
-pub struct HasSpecialStuffTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `has_special_stuff`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait HasSpecialStuffTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`HasSpecialStuffTableHandle`], which mediates access to the table `has_special_stuff`.
- fn has_special_stuff(&self) -> HasSpecialStuffTableHandle<'_>;
-}
-
-impl HasSpecialStuffTableAccess for super::RemoteTables {
- fn has_special_stuff(&self) -> HasSpecialStuffTableHandle<'_> {
- HasSpecialStuffTableHandle {
- imp: self.imp.get_table::("has_special_stuff"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct HasSpecialStuffInsertCallbackId(__sdk::CallbackId);
-pub struct HasSpecialStuffDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for HasSpecialStuffTableHandle<'ctx> {
- type Row = HasSpecialStuff;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = HasSpecialStuffInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> HasSpecialStuffInsertCallbackId {
- HasSpecialStuffInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: HasSpecialStuffInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = HasSpecialStuffDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> HasSpecialStuffDeleteCallbackId {
- HasSpecialStuffDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: HasSpecialStuffDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("has_special_stuff");
-}
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `HasSpecialStuff`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait has_special_stuffQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `HasSpecialStuff`.
- fn has_special_stuff(&self) -> __sdk::__query_builder::Table;
- }
-
- impl has_special_stuffQueryTableAccess for __sdk::QueryTableAccessor {
- fn has_special_stuff(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("has_special_stuff")
- }
- }
-
'''
"has_special_stuff_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -1435,18 +1318,10 @@ pub mod query_private_reducer;
pub mod say_hello_reducer;
pub mod test_reducer;
pub mod test_btree_index_args_reducer;
-pub mod has_special_stuff_table;
pub mod logged_out_player_table;
pub mod person_table;
-pub mod pk_multi_identity_table;
pub mod player_table;
-pub mod points_table;
-pub mod private_table_table;
-pub mod repeating_test_arg_table;
-pub mod table_to_remove_table;
-pub mod test_a_table;
pub mod test_d_table;
-pub mod test_e_table;
pub mod test_f_table;
pub mod my_player_table;
pub mod get_my_schema_via_http_procedure;
@@ -1471,19 +1346,11 @@ pub use test_e_type::TestE;
pub use test_foobar_type::TestFoobar;
pub use namespace_test_c_type::NamespaceTestC;
pub use namespace_test_f_type::NamespaceTestF;
-pub use has_special_stuff_table::*;
pub use logged_out_player_table::*;
pub use my_player_table::*;
pub use person_table::*;
-pub use pk_multi_identity_table::*;
pub use player_table::*;
-pub use points_table::*;
-pub use private_table_table::*;
-pub use repeating_test_arg_table::*;
-pub use table_to_remove_table::*;
-pub use test_a_table::*;
pub use test_d_table::*;
-pub use test_e_table::*;
pub use test_f_table::*;
pub use add_reducer::{add, set_flags_for_add, AddCallbackId};
pub use add_player_reducer::{add_player, set_flags_for_add_player, AddPlayerCallbackId};
@@ -1591,19 +1458,11 @@ fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result,
- logged_out_player: __sdk::TableUpdate,
+ logged_out_player: __sdk::TableUpdate,
my_player: __sdk::TableUpdate,
person: __sdk::TableUpdate,
- pk_multi_identity: __sdk::TableUpdate,
player: __sdk::TableUpdate,
- points: __sdk::TableUpdate,
- private_table: __sdk::TableUpdate,
- repeating_test_arg: __sdk::TableUpdate,
- table_to_remove: __sdk::TableUpdate,
- test_a: __sdk::TableUpdate,
test_d: __sdk::TableUpdate,
- test_e: __sdk::TableUpdate,
test_f: __sdk::TableUpdate,
}
@@ -1615,19 +1474,11 @@ impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
for table_update in raw.tables {
match &table_update.table_name[..] {
- "has_special_stuff" => db_update.has_special_stuff.append(has_special_stuff_table::parse_table_update(table_update)?),
- "logged_out_player" => db_update.logged_out_player.append(logged_out_player_table::parse_table_update(table_update)?),
+ "logged_out_player" => db_update.logged_out_player.append(logged_out_player_table::parse_table_update(table_update)?),
"my_player" => db_update.my_player.append(my_player_table::parse_table_update(table_update)?),
"person" => db_update.person.append(person_table::parse_table_update(table_update)?),
- "pk_multi_identity" => db_update.pk_multi_identity.append(pk_multi_identity_table::parse_table_update(table_update)?),
"player" => db_update.player.append(player_table::parse_table_update(table_update)?),
- "points" => db_update.points.append(points_table::parse_table_update(table_update)?),
- "private_table" => db_update.private_table.append(private_table_table::parse_table_update(table_update)?),
- "repeating_test_arg" => db_update.repeating_test_arg.append(repeating_test_arg_table::parse_table_update(table_update)?),
- "table_to_remove" => db_update.table_to_remove.append(table_to_remove_table::parse_table_update(table_update)?),
- "test_a" => db_update.test_a.append(test_a_table::parse_table_update(table_update)?),
"test_d" => db_update.test_d.append(test_d_table::parse_table_update(table_update)?),
- "test_e" => db_update.test_e.append(test_e_table::parse_table_update(table_update)?),
"test_f" => db_update.test_f.append(test_f_table::parse_table_update(table_update)?),
unknown => {
@@ -1651,18 +1502,10 @@ impl __sdk::DbUpdate for DbUpdate {
fn apply_to_client_cache(&self, cache: &mut __sdk::ClientCache) -> AppliedDiff<'_> {
let mut diff = AppliedDiff::default();
- diff.has_special_stuff = cache.apply_diff_to_table::("has_special_stuff", &self.has_special_stuff);
- diff.logged_out_player = cache.apply_diff_to_table::("logged_out_player", &self.logged_out_player).with_updates_by_pk(|row| &row.identity);
+ diff.logged_out_player = cache.apply_diff_to_table::("logged_out_player", &self.logged_out_player).with_updates_by_pk(|row| &row.identity);
diff.person = cache.apply_diff_to_table::("person", &self.person).with_updates_by_pk(|row| &row.id);
- diff.pk_multi_identity = cache.apply_diff_to_table::("pk_multi_identity", &self.pk_multi_identity).with_updates_by_pk(|row| &row.id);
diff.player = cache.apply_diff_to_table::("player", &self.player).with_updates_by_pk(|row| &row.identity);
- diff.points = cache.apply_diff_to_table::("points", &self.points);
- diff.private_table = cache.apply_diff_to_table::("private_table", &self.private_table);
- diff.repeating_test_arg = cache.apply_diff_to_table::("repeating_test_arg", &self.repeating_test_arg).with_updates_by_pk(|row| &row.scheduled_id);
- diff.table_to_remove = cache.apply_diff_to_table::("table_to_remove", &self.table_to_remove);
- diff.test_a = cache.apply_diff_to_table::("test_a", &self.test_a);
diff.test_d = cache.apply_diff_to_table::("test_d", &self.test_d);
- diff.test_e = cache.apply_diff_to_table::("test_e", &self.test_e).with_updates_by_pk(|row| &row.id);
diff.test_f = cache.apply_diff_to_table::("test_f", &self.test_f);
diff.my_player = cache.apply_diff_to_table::("my_player", &self.my_player);
@@ -1674,19 +1517,11 @@ impl __sdk::DbUpdate for DbUpdate {
#[allow(non_snake_case)]
#[doc(hidden)]
pub struct AppliedDiff<'r> {
- has_special_stuff: __sdk::TableAppliedDiff<'r, HasSpecialStuff>,
- logged_out_player: __sdk::TableAppliedDiff<'r, Player>,
+ logged_out_player: __sdk::TableAppliedDiff<'r, Player>,
my_player: __sdk::TableAppliedDiff<'r, Player>,
person: __sdk::TableAppliedDiff<'r, Person>,
- pk_multi_identity: __sdk::TableAppliedDiff<'r, PkMultiIdentity>,
player: __sdk::TableAppliedDiff<'r, Player>,
- points: __sdk::TableAppliedDiff<'r, Point>,
- private_table: __sdk::TableAppliedDiff<'r, PrivateTable>,
- repeating_test_arg: __sdk::TableAppliedDiff<'r, RepeatingTestArg>,
- table_to_remove: __sdk::TableAppliedDiff<'r, RemoveTable>,
- test_a: __sdk::TableAppliedDiff<'r, TestA>,
test_d: __sdk::TableAppliedDiff<'r, TestD>,
- test_e: __sdk::TableAppliedDiff<'r, TestE>,
test_f: __sdk::TableAppliedDiff<'r, TestFoobar>,
__unused: std::marker::PhantomData<&'r ()>,
}
@@ -1698,19 +1533,11 @@ impl __sdk::InModule for AppliedDiff<'_> {
impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks) {
- callbacks.invoke_table_row_callbacks::("has_special_stuff", &self.has_special_stuff, event);
- callbacks.invoke_table_row_callbacks::("logged_out_player", &self.logged_out_player, event);
+ callbacks.invoke_table_row_callbacks::("logged_out_player", &self.logged_out_player, event);
callbacks.invoke_table_row_callbacks::("my_player", &self.my_player, event);
callbacks.invoke_table_row_callbacks::("person", &self.person, event);
- callbacks.invoke_table_row_callbacks::("pk_multi_identity", &self.pk_multi_identity, event);
callbacks.invoke_table_row_callbacks::("player", &self.player, event);
- callbacks.invoke_table_row_callbacks::("points", &self.points, event);
- callbacks.invoke_table_row_callbacks::("private_table", &self.private_table, event);
- callbacks.invoke_table_row_callbacks::("repeating_test_arg", &self.repeating_test_arg, event);
- callbacks.invoke_table_row_callbacks::("table_to_remove", &self.table_to_remove, event);
- callbacks.invoke_table_row_callbacks::("test_a", &self.test_a, event);
callbacks.invoke_table_row_callbacks::("test_d", &self.test_d, event);
- callbacks.invoke_table_row_callbacks::("test_e", &self.test_e, event);
callbacks.invoke_table_row_callbacks::("test_f", &self.test_f, event);
}
}
@@ -2429,19 +2256,11 @@ impl __sdk::SpacetimeModule for RemoteModule {
type QueryBuilder = __sdk::QueryBuilder;
fn register_tables(client_cache: &mut __sdk::ClientCache) {
- has_special_stuff_table::register_table(client_cache);
- logged_out_player_table::register_table(client_cache);
+ logged_out_player_table::register_table(client_cache);
my_player_table::register_table(client_cache);
person_table::register_table(client_cache);
- pk_multi_identity_table::register_table(client_cache);
player_table::register_table(client_cache);
- points_table::register_table(client_cache);
- private_table_table::register_table(client_cache);
- repeating_test_arg_table::register_table(client_cache);
- table_to_remove_table::register_table(client_cache);
- test_a_table::register_table(client_cache);
test_d_table::register_table(client_cache);
- test_e_table::register_table(client_cache);
test_f_table::register_table(client_cache);
}
}
@@ -2855,202 +2674,6 @@ impl __sdk::__query_builder::HasIxCols for Person {
}
}
-'''
-"pk_multi_identity_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::pk_multi_identity_type::PkMultiIdentity;
-
-/// Table handle for the table `pk_multi_identity`.
-///
-/// Obtain a handle from the [`PkMultiIdentityTableAccess::pk_multi_identity`] method on [`super::RemoteTables`],
-/// like `ctx.db.pk_multi_identity()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.pk_multi_identity().on_insert(...)`.
-pub struct PkMultiIdentityTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `pk_multi_identity`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait PkMultiIdentityTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`PkMultiIdentityTableHandle`], which mediates access to the table `pk_multi_identity`.
- fn pk_multi_identity(&self) -> PkMultiIdentityTableHandle<'_>;
-}
-
-impl PkMultiIdentityTableAccess for super::RemoteTables {
- fn pk_multi_identity(&self) -> PkMultiIdentityTableHandle<'_> {
- PkMultiIdentityTableHandle {
- imp: self.imp.get_table::("pk_multi_identity"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct PkMultiIdentityInsertCallbackId(__sdk::CallbackId);
-pub struct PkMultiIdentityDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for PkMultiIdentityTableHandle<'ctx> {
- type Row = PkMultiIdentity;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = PkMultiIdentityInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PkMultiIdentityInsertCallbackId {
- PkMultiIdentityInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: PkMultiIdentityInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = PkMultiIdentityDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PkMultiIdentityDeleteCallbackId {
- PkMultiIdentityDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: PkMultiIdentityDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("pk_multi_identity");
- _table.add_unique_constraint::("id", |row| &row.id);
- _table.add_unique_constraint::("other", |row| &row.other);
-}
-pub struct PkMultiIdentityUpdateCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::TableWithPrimaryKey for PkMultiIdentityTableHandle<'ctx> {
- type UpdateCallbackId = PkMultiIdentityUpdateCallbackId;
-
- fn on_update(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
- ) -> PkMultiIdentityUpdateCallbackId {
- PkMultiIdentityUpdateCallbackId(self.imp.on_update(Box::new(callback)))
- }
-
- fn remove_on_update(&self, callback: PkMultiIdentityUpdateCallbackId) {
- self.imp.remove_on_update(callback.0)
- }
-}
-
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- /// Access to the `id` unique index on the table `pk_multi_identity`,
- /// which allows point queries on the field of the same name
- /// via the [`PkMultiIdentityIdUnique::find`] method.
- ///
- /// Users are encouraged not to explicitly reference this type,
- /// but to directly chain method calls,
- /// like `ctx.db.pk_multi_identity().id().find(...)`.
- pub struct PkMultiIdentityIdUnique<'ctx> {
- imp: __sdk::UniqueConstraintHandle,
- phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
- }
-
- impl<'ctx> PkMultiIdentityTableHandle<'ctx> {
- /// Get a handle on the `id` unique index on the table `pk_multi_identity`.
- pub fn id(&self) -> PkMultiIdentityIdUnique<'ctx> {
- PkMultiIdentityIdUnique {
- imp: self.imp.get_unique_constraint::("id"),
- phantom: std::marker::PhantomData,
- }
- }
- }
-
- impl<'ctx> PkMultiIdentityIdUnique<'ctx> {
- /// Find the subscribed row whose `id` column value is equal to `col_val`,
- /// if such a row is present in the client cache.
- pub fn find(&self, col_val: &u32) -> Option {
- self.imp.find(col_val)
- }
- }
-
- /// Access to the `other` unique index on the table `pk_multi_identity`,
- /// which allows point queries on the field of the same name
- /// via the [`PkMultiIdentityOtherUnique::find`] method.
- ///
- /// Users are encouraged not to explicitly reference this type,
- /// but to directly chain method calls,
- /// like `ctx.db.pk_multi_identity().other().find(...)`.
- pub struct PkMultiIdentityOtherUnique<'ctx> {
- imp: __sdk::UniqueConstraintHandle,
- phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
- }
-
- impl<'ctx> PkMultiIdentityTableHandle<'ctx> {
- /// Get a handle on the `other` unique index on the table `pk_multi_identity`.
- pub fn other(&self) -> PkMultiIdentityOtherUnique<'ctx> {
- PkMultiIdentityOtherUnique {
- imp: self.imp.get_unique_constraint::("other"),
- phantom: std::marker::PhantomData,
- }
- }
- }
-
- impl<'ctx> PkMultiIdentityOtherUnique<'ctx> {
- /// Find the subscribed row whose `other` column value is equal to `col_val`,
- /// if such a row is present in the client cache.
- pub fn find(&self, col_val: &u32) -> Option {
- self.imp.find(col_val)
- }
- }
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `PkMultiIdentity`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait pk_multi_identityQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `PkMultiIdentity`.
- fn pk_multi_identity(&self) -> __sdk::__query_builder::Table;
- }
-
- impl pk_multi_identityQueryTableAccess for __sdk::QueryTableAccessor {
- fn pk_multi_identity(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("pk_multi_identity")
- }
- }
-
'''
"pk_multi_identity_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -3475,7 +3098,7 @@ impl __sdk::__query_builder::HasIxCols for Point {
}
'''
-"points_table.rs" = '''
+"private_table_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
@@ -3486,285 +3109,51 @@ use spacetimedb_sdk::__codegen::{
__sats,
__ws,
};
-use super::point_type::Point;
-/// Table handle for the table `points`.
-///
-/// Obtain a handle from the [`PointsTableAccess::points`] method on [`super::RemoteTables`],
-/// like `ctx.db.points()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.points().on_insert(...)`.
-pub struct PointsTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
+
+#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
+#[sats(crate = __lib)]
+pub struct PrivateTable {
+ pub name: String,
}
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `points`.
+
+impl __sdk::InModule for PrivateTable {
+ type Module = super::RemoteModule;
+}
+
+
+/// Column accessor struct for the table `PrivateTable`.
///
-/// Implemented for [`super::RemoteTables`].
-pub trait PointsTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`PointsTableHandle`], which mediates access to the table `points`.
- fn points(&self) -> PointsTableHandle<'_>;
+/// Provides typed access to columns for query building.
+pub struct PrivateTableCols {
+ pub name: __sdk::__query_builder::Col,
}
-impl PointsTableAccess for super::RemoteTables {
- fn points(&self) -> PointsTableHandle<'_> {
- PointsTableHandle {
- imp: self.imp.get_table::("points"),
- ctx: std::marker::PhantomData,
+impl __sdk::__query_builder::HasCols for PrivateTable {
+ type Cols = PrivateTableCols;
+ fn cols(table_name: &'static str) -> Self::Cols {
+ PrivateTableCols {
+ name: __sdk::__query_builder::Col::new(table_name, "name"),
+
}
}
}
-pub struct PointsInsertCallbackId(__sdk::CallbackId);
-pub struct PointsDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for PointsTableHandle<'ctx> {
- type Row = Point;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = PointsInsertCallbackId;
+/// Indexed column accessor struct for the table `PrivateTable`.
+///
+/// Provides typed access to indexed columns for query building.
+pub struct PrivateTableIxCols {
+}
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PointsInsertCallbackId {
- PointsInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
+impl __sdk::__query_builder::HasIxCols for PrivateTable {
+ type IxCols = PrivateTableIxCols;
+ fn ix_cols(table_name: &'static str) -> Self::IxCols {
+ PrivateTableIxCols {
- fn remove_on_insert(&self, callback: PointsInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
+ }
}
-
- type DeleteCallbackId = PointsDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PointsDeleteCallbackId {
- PointsDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: PointsDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("points");
-}
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `Point`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait pointsQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `Point`.
- fn points(&self) -> __sdk::__query_builder::Table;
- }
-
- impl pointsQueryTableAccess for __sdk::QueryTableAccessor {
- fn points(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("points")
- }
- }
-
-'''
-"private_table_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::private_table_type::PrivateTable;
-
-/// Table handle for the table `private_table`.
-///
-/// Obtain a handle from the [`PrivateTableTableAccess::private_table`] method on [`super::RemoteTables`],
-/// like `ctx.db.private_table()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.private_table().on_insert(...)`.
-pub struct PrivateTableTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `private_table`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait PrivateTableTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`PrivateTableTableHandle`], which mediates access to the table `private_table`.
- fn private_table(&self) -> PrivateTableTableHandle<'_>;
-}
-
-impl PrivateTableTableAccess for super::RemoteTables {
- fn private_table(&self) -> PrivateTableTableHandle<'_> {
- PrivateTableTableHandle {
- imp: self.imp.get_table::("private_table"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct PrivateTableInsertCallbackId(__sdk::CallbackId);
-pub struct PrivateTableDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for PrivateTableTableHandle<'ctx> {
- type Row = PrivateTable;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = PrivateTableInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PrivateTableInsertCallbackId {
- PrivateTableInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: PrivateTableInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = PrivateTableDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> PrivateTableDeleteCallbackId {
- PrivateTableDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: PrivateTableDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("private_table");
-}
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `PrivateTable`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait private_tableQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `PrivateTable`.
- fn private_table(&self) -> __sdk::__query_builder::Table;
- }
-
- impl private_tableQueryTableAccess for __sdk::QueryTableAccessor {
- fn private_table(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("private_table")
- }
- }
-
-'''
-"private_table_type.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-
-
-#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
-#[sats(crate = __lib)]
-pub struct PrivateTable {
- pub name: String,
-}
-
-
-impl __sdk::InModule for PrivateTable {
- type Module = super::RemoteModule;
-}
-
-
-/// Column accessor struct for the table `PrivateTable`.
-///
-/// Provides typed access to columns for query building.
-pub struct PrivateTableCols {
- pub name: __sdk::__query_builder::Col,
-}
-
-impl __sdk::__query_builder::HasCols for PrivateTable {
- type Cols = PrivateTableCols;
- fn cols(table_name: &'static str) -> Self::Cols {
- PrivateTableCols {
- name: __sdk::__query_builder::Col::new(table_name, "name"),
-
- }
- }
-}
-
-/// Indexed column accessor struct for the table `PrivateTable`.
-///
-/// Provides typed access to indexed columns for query building.
-pub struct PrivateTableIxCols {
-}
-
-impl __sdk::__query_builder::HasIxCols for PrivateTable {
- type IxCols = PrivateTableIxCols;
- fn ix_cols(table_name: &'static str) -> Self::IxCols {
- PrivateTableIxCols {
-
- }
- }
-}
+}
'''
"query_private_reducer.rs" = '''
@@ -3929,171 +3318,6 @@ impl __sdk::__query_builder::HasIxCols for RemoveTable {
}
}
-'''
-"repeating_test_arg_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::repeating_test_arg_type::RepeatingTestArg;
-
-/// Table handle for the table `repeating_test_arg`.
-///
-/// Obtain a handle from the [`RepeatingTestArgTableAccess::repeating_test_arg`] method on [`super::RemoteTables`],
-/// like `ctx.db.repeating_test_arg()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.repeating_test_arg().on_insert(...)`.
-pub struct RepeatingTestArgTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `repeating_test_arg`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait RepeatingTestArgTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`RepeatingTestArgTableHandle`], which mediates access to the table `repeating_test_arg`.
- fn repeating_test_arg(&self) -> RepeatingTestArgTableHandle<'_>;
-}
-
-impl RepeatingTestArgTableAccess for super::RemoteTables {
- fn repeating_test_arg(&self) -> RepeatingTestArgTableHandle<'_> {
- RepeatingTestArgTableHandle {
- imp: self.imp.get_table::("repeating_test_arg"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct RepeatingTestArgInsertCallbackId(__sdk::CallbackId);
-pub struct RepeatingTestArgDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for RepeatingTestArgTableHandle<'ctx> {
- type Row = RepeatingTestArg;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = RepeatingTestArgInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> RepeatingTestArgInsertCallbackId {
- RepeatingTestArgInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: RepeatingTestArgInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = RepeatingTestArgDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> RepeatingTestArgDeleteCallbackId {
- RepeatingTestArgDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: RepeatingTestArgDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("repeating_test_arg");
- _table.add_unique_constraint::("scheduled_id", |row| &row.scheduled_id);
-}
-pub struct RepeatingTestArgUpdateCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::TableWithPrimaryKey for RepeatingTestArgTableHandle<'ctx> {
- type UpdateCallbackId = RepeatingTestArgUpdateCallbackId;
-
- fn on_update(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
- ) -> RepeatingTestArgUpdateCallbackId {
- RepeatingTestArgUpdateCallbackId(self.imp.on_update(Box::new(callback)))
- }
-
- fn remove_on_update(&self, callback: RepeatingTestArgUpdateCallbackId) {
- self.imp.remove_on_update(callback.0)
- }
-}
-
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- /// Access to the `scheduled_id` unique index on the table `repeating_test_arg`,
- /// which allows point queries on the field of the same name
- /// via the [`RepeatingTestArgScheduledIdUnique::find`] method.
- ///
- /// Users are encouraged not to explicitly reference this type,
- /// but to directly chain method calls,
- /// like `ctx.db.repeating_test_arg().scheduled_id().find(...)`.
- pub struct RepeatingTestArgScheduledIdUnique<'ctx> {
- imp: __sdk::UniqueConstraintHandle,
- phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
- }
-
- impl<'ctx> RepeatingTestArgTableHandle<'ctx> {
- /// Get a handle on the `scheduled_id` unique index on the table `repeating_test_arg`.
- pub fn scheduled_id(&self) -> RepeatingTestArgScheduledIdUnique<'ctx> {
- RepeatingTestArgScheduledIdUnique {
- imp: self.imp.get_unique_constraint::("scheduled_id"),
- phantom: std::marker::PhantomData,
- }
- }
- }
-
- impl<'ctx> RepeatingTestArgScheduledIdUnique<'ctx> {
- /// Find the subscribed row whose `scheduled_id` column value is equal to `col_val`,
- /// if such a row is present in the client cache.
- pub fn find(&self, col_val: &u64) -> Option {
- self.imp.find(col_val)
- }
- }
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `RepeatingTestArg`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait repeating_test_argQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `RepeatingTestArg`.
- fn repeating_test_arg(&self) -> __sdk::__query_builder::Table;
- }
-
- impl repeating_test_argQueryTableAccess for __sdk::QueryTableAccessor {
- fn repeating_test_arg(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("repeating_test_arg")
- }
- }
-
'''
"repeating_test_arg_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -4272,231 +3496,60 @@ pub trait say_hello {
/// Cancel a callback previously registered by [`Self::on_say_hello`],
/// causing it not to run in the future.
fn remove_on_say_hello(&self, callback: SayHelloCallbackId);
-}
-
-impl say_hello for super::RemoteReducers {
- fn say_hello(&self, ) -> __sdk::Result<()> {
- self.imp.call_reducer("say_hello", SayHelloArgs { })
- }
- fn on_say_hello(
- &self,
- mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static,
- ) -> SayHelloCallbackId {
- SayHelloCallbackId(self.imp.on_reducer(
- "say_hello",
- Box::new(move |ctx: &super::ReducerEventContext| {
- #[allow(irrefutable_let_patterns)]
- let super::ReducerEventContext {
- event: __sdk::ReducerEvent {
- reducer: super::Reducer::SayHello {
-
- },
- ..
- },
- ..
- } = ctx else { unreachable!() };
- callback(ctx, )
- }),
- ))
- }
- fn remove_on_say_hello(&self, callback: SayHelloCallbackId) {
- self.imp.remove_on_reducer("say_hello", callback.0)
- }
-}
-
-#[allow(non_camel_case_types)]
-#[doc(hidden)]
-/// Extension trait for setting the call-flags for the reducer `say_hello`.
-///
-/// Implemented for [`super::SetReducerFlags`].
-///
-/// This type is currently unstable and may be removed without a major version bump.
-pub trait set_flags_for_say_hello {
- /// Set the call-reducer flags for the reducer `say_hello` to `flags`.
- ///
- /// This type is currently unstable and may be removed without a major version bump.
- fn say_hello(&self, flags: __ws::CallReducerFlags);
-}
-
-impl set_flags_for_say_hello for super::SetReducerFlags {
- fn say_hello(&self, flags: __ws::CallReducerFlags) {
- self.imp.set_call_reducer_flags("say_hello", flags);
- }
-}
-
-'''
-"sleep_one_second_procedure.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-
-
-#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
-#[sats(crate = __lib)]
- struct SleepOneSecondArgs {
- }
-
-
-impl __sdk::InModule for SleepOneSecondArgs {
- type Module = super::RemoteModule;
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the procedure `sleep_one_second`.
-///
-/// Implemented for [`super::RemoteProcedures`].
-pub trait sleep_one_second {
- fn sleep_one_second(&self, ) {
- self.sleep_one_second_then( |_, _| {});
- }
-
- fn sleep_one_second_then(
- &self,
-
- __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static,
- );
-}
-
-impl sleep_one_second for super::RemoteProcedures {
- fn sleep_one_second_then(
- &self,
-
- __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static,
- ) {
- self.imp.invoke_procedure_with_callback::<_, ()>(
- "sleep_one_second",
- SleepOneSecondArgs { },
- __callback,
- );
- }
-}
-
-'''
-"table_to_remove_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::remove_table_type::RemoveTable;
-
-/// Table handle for the table `table_to_remove`.
-///
-/// Obtain a handle from the [`TableToRemoveTableAccess::table_to_remove`] method on [`super::RemoteTables`],
-/// like `ctx.db.table_to_remove()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.table_to_remove().on_insert(...)`.
-pub struct TableToRemoveTableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `table_to_remove`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait TableToRemoveTableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`TableToRemoveTableHandle`], which mediates access to the table `table_to_remove`.
- fn table_to_remove(&self) -> TableToRemoveTableHandle<'_>;
-}
-
-impl TableToRemoveTableAccess for super::RemoteTables {
- fn table_to_remove(&self) -> TableToRemoveTableHandle<'_> {
- TableToRemoveTableHandle {
- imp: self.imp.get_table::("table_to_remove"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct TableToRemoveInsertCallbackId(__sdk::CallbackId);
-pub struct TableToRemoveDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for TableToRemoveTableHandle<'ctx> {
- type Row = RemoveTable;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = TableToRemoveInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TableToRemoveInsertCallbackId {
- TableToRemoveInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: TableToRemoveInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = TableToRemoveDeleteCallbackId;
+}
- fn on_delete(
+impl say_hello for super::RemoteReducers {
+ fn say_hello(&self, ) -> __sdk::Result<()> {
+ self.imp.call_reducer("say_hello", SayHelloArgs { })
+ }
+ fn on_say_hello(
&self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TableToRemoveDeleteCallbackId {
- TableToRemoveDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
+ mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static,
+ ) -> SayHelloCallbackId {
+ SayHelloCallbackId(self.imp.on_reducer(
+ "say_hello",
+ Box::new(move |ctx: &super::ReducerEventContext| {
+ #[allow(irrefutable_let_patterns)]
+ let super::ReducerEventContext {
+ event: __sdk::ReducerEvent {
+ reducer: super::Reducer::SayHello {
+
+ },
+ ..
+ },
+ ..
+ } = ctx else { unreachable!() };
+ callback(ctx, )
+ }),
+ ))
}
-
- fn remove_on_delete(&self, callback: TableToRemoveDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
+ fn remove_on_say_hello(&self, callback: SayHelloCallbackId) {
+ self.imp.remove_on_reducer("say_hello", callback.0)
}
}
+#[allow(non_camel_case_types)]
#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("table_to_remove");
+/// Extension trait for setting the call-flags for the reducer `say_hello`.
+///
+/// Implemented for [`super::SetReducerFlags`].
+///
+/// This type is currently unstable and may be removed without a major version bump.
+pub trait set_flags_for_say_hello {
+ /// Set the call-reducer flags for the reducer `say_hello` to `flags`.
+ ///
+ /// This type is currently unstable and may be removed without a major version bump.
+ fn say_hello(&self, flags: __ws::CallReducerFlags);
}
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
+impl set_flags_for_say_hello for super::SetReducerFlags {
+ fn say_hello(&self, flags: __ws::CallReducerFlags) {
+ self.imp.set_call_reducer_flags("say_hello", flags);
+ }
}
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `RemoveTable`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait table_to_removeQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `RemoveTable`.
- fn table_to_remove(&self) -> __sdk::__query_builder::Table;
- }
-
- impl table_to_removeQueryTableAccess for __sdk::QueryTableAccessor {
- fn table_to_remove(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("table_to_remove")
- }
- }
-
'''
-"test_a_table.rs" = '''
+"sleep_one_second_procedure.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
@@ -4507,111 +3560,48 @@ use spacetimedb_sdk::__codegen::{
__sats,
__ws,
};
-use super::test_a_type::TestA;
-
-/// Table handle for the table `test_a`.
-///
-/// Obtain a handle from the [`TestATableAccess::test_a`] method on [`super::RemoteTables`],
-/// like `ctx.db.test_a()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.test_a().on_insert(...)`.
-pub struct TestATableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `test_a`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait TestATableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`TestATableHandle`], which mediates access to the table `test_a`.
- fn test_a(&self) -> TestATableHandle<'_>;
-}
-impl TestATableAccess for super::RemoteTables {
- fn test_a(&self) -> TestATableHandle<'_> {
- TestATableHandle {
- imp: self.imp.get_table::("test_a"),
- ctx: std::marker::PhantomData,
- }
+#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
+#[sats(crate = __lib)]
+ struct SleepOneSecondArgs {
}
-}
-
-pub struct TestAInsertCallbackId(__sdk::CallbackId);
-pub struct TestADeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for TestATableHandle<'ctx> {
- type Row = TestA;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
- type InsertCallbackId = TestAInsertCallbackId;
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TestAInsertCallbackId {
- TestAInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
+impl __sdk::InModule for SleepOneSecondArgs {
+ type Module = super::RemoteModule;
+}
- fn remove_on_insert(&self, callback: TestAInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
+#[allow(non_camel_case_types)]
+/// Extension trait for access to the procedure `sleep_one_second`.
+///
+/// Implemented for [`super::RemoteProcedures`].
+pub trait sleep_one_second {
+ fn sleep_one_second(&self, ) {
+ self.sleep_one_second_then( |_, _| {});
}
- type DeleteCallbackId = TestADeleteCallbackId;
-
- fn on_delete(
+ fn sleep_one_second_then(
&self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TestADeleteCallbackId {
- TestADeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: TestADeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("test_a");
+
+ __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static,
+ );
}
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
+impl sleep_one_second for super::RemoteProcedures {
+ fn sleep_one_second_then(
+ &self,
+
+ __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static,
+ ) {
+ self.imp.invoke_procedure_with_callback::<_, ()>(
+ "sleep_one_second",
+ SleepOneSecondArgs { },
+ __callback,
+ );
+ }
}
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `TestA`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait test_aQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `TestA`.
- fn test_a(&self) -> __sdk::__query_builder::Table;
- }
-
- impl test_aQueryTableAccess for __sdk::QueryTableAccessor {
- fn test_a(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("test_a")
- }
- }
-
'''
"test_a_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -4985,171 +3975,6 @@ impl __sdk::__query_builder::HasIxCols for TestD {
}
}
-'''
-"test_e_table.rs" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-#![allow(unused, clippy::all)]
-use spacetimedb_sdk::__codegen::{
- self as __sdk,
- __lib,
- __sats,
- __ws,
-};
-use super::test_e_type::TestE;
-
-/// Table handle for the table `test_e`.
-///
-/// Obtain a handle from the [`TestETableAccess::test_e`] method on [`super::RemoteTables`],
-/// like `ctx.db.test_e()`.
-///
-/// Users are encouraged not to explicitly reference this type,
-/// but to directly chain method calls,
-/// like `ctx.db.test_e().on_insert(...)`.
-pub struct TestETableHandle<'ctx> {
- imp: __sdk::TableHandle,
- ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
-}
-
-#[allow(non_camel_case_types)]
-/// Extension trait for access to the table `test_e`.
-///
-/// Implemented for [`super::RemoteTables`].
-pub trait TestETableAccess {
- #[allow(non_snake_case)]
- /// Obtain a [`TestETableHandle`], which mediates access to the table `test_e`.
- fn test_e(&self) -> TestETableHandle<'_>;
-}
-
-impl TestETableAccess for super::RemoteTables {
- fn test_e(&self) -> TestETableHandle<'_> {
- TestETableHandle {
- imp: self.imp.get_table::("test_e"),
- ctx: std::marker::PhantomData,
- }
- }
-}
-
-pub struct TestEInsertCallbackId(__sdk::CallbackId);
-pub struct TestEDeleteCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::Table for TestETableHandle<'ctx> {
- type Row = TestE;
- type EventContext = super::EventContext;
-
- fn count(&self) -> u64 { self.imp.count() }
- fn iter(&self) -> impl Iterator
- + '_ { self.imp.iter() }
-
- type InsertCallbackId = TestEInsertCallbackId;
-
- fn on_insert(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TestEInsertCallbackId {
- TestEInsertCallbackId(self.imp.on_insert(Box::new(callback)))
- }
-
- fn remove_on_insert(&self, callback: TestEInsertCallbackId) {
- self.imp.remove_on_insert(callback.0)
- }
-
- type DeleteCallbackId = TestEDeleteCallbackId;
-
- fn on_delete(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
- ) -> TestEDeleteCallbackId {
- TestEDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
- }
-
- fn remove_on_delete(&self, callback: TestEDeleteCallbackId) {
- self.imp.remove_on_delete(callback.0)
- }
-}
-
-#[doc(hidden)]
-pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) {
-
- let _table = client_cache.get_or_make_table::("test_e");
- _table.add_unique_constraint::("id", |row| &row.id);
-}
-pub struct TestEUpdateCallbackId(__sdk::CallbackId);
-
-impl<'ctx> __sdk::TableWithPrimaryKey for TestETableHandle<'ctx> {
- type UpdateCallbackId = TestEUpdateCallbackId;
-
- fn on_update(
- &self,
- callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
- ) -> TestEUpdateCallbackId {
- TestEUpdateCallbackId(self.imp.on_update(Box::new(callback)))
- }
-
- fn remove_on_update(&self, callback: TestEUpdateCallbackId) {
- self.imp.remove_on_update(callback.0)
- }
-}
-
-
-#[doc(hidden)]
-pub(super) fn parse_table_update(
- raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
-) -> __sdk::Result<__sdk::TableUpdate> {
- __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
- __sdk::InternalError::failed_parse(
- "TableUpdate",
- "TableUpdate",
- ).with_cause(e).into()
- })
-}
-
- /// Access to the `id` unique index on the table `test_e`,
- /// which allows point queries on the field of the same name
- /// via the [`TestEIdUnique::find`] method.
- ///
- /// Users are encouraged not to explicitly reference this type,
- /// but to directly chain method calls,
- /// like `ctx.db.test_e().id().find(...)`.
- pub struct TestEIdUnique<'ctx> {
- imp: __sdk::UniqueConstraintHandle,
- phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
- }
-
- impl<'ctx> TestETableHandle<'ctx> {
- /// Get a handle on the `id` unique index on the table `test_e`.
- pub fn id(&self) -> TestEIdUnique<'ctx> {
- TestEIdUnique {
- imp: self.imp.get_unique_constraint::("id"),
- phantom: std::marker::PhantomData,
- }
- }
- }
-
- impl<'ctx> TestEIdUnique<'ctx> {
- /// Find the subscribed row whose `id` column value is equal to `col_val`,
- /// if such a row is present in the client cache.
- pub fn find(&self, col_val: &u64) -> Option {
- self.imp.find(col_val)
- }
- }
-
- #[allow(non_camel_case_types)]
- /// Extension trait for query builder access to the table `TestE`.
- ///
- /// Implemented for [`__sdk::QueryTableAccessor`].
- pub trait test_eQueryTableAccess {
- #[allow(non_snake_case)]
- /// Get a query builder for the table `TestE`.
- fn test_e(&self) -> __sdk::__query_builder::Table;
- }
-
- impl test_eQueryTableAccess for __sdk::QueryTableAccessor {
- fn test_e(&self) -> __sdk::__query_builder::Table {
- __sdk::__query_builder::Table::new("test_e")
- }
- }
-
'''
"test_e_type.rs" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap
index d3df905c700..f5ae325d55c 100644
--- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap
+++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap
@@ -1,5 +1,6 @@
---
source: crates/codegen/tests/codegen.rs
+assertion_line: 37
expression: outfiles
---
"add_player_reducer.ts" = '''
@@ -165,24 +166,6 @@ import {
export const params = {
};
export const returnType = __t.string()'''
-"has_special_stuff_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- identity: __t.identity(),
- connectionId: __t.connectionId().name("connection_id"),
-});
-'''
"has_special_stuff_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
@@ -276,32 +259,16 @@ import * as WithTxProcedure from "./with_tx_procedure";
export { WithTxProcedure };
// Import and reexport all table handle types
-import HasSpecialStuffRow from "./has_special_stuff_table";
-export { HasSpecialStuffRow };
import LoggedOutPlayerRow from "./logged_out_player_table";
export { LoggedOutPlayerRow };
import MyPlayerRow from "./my_player_table";
export { MyPlayerRow };
import PersonRow from "./person_table";
export { PersonRow };
-import PkMultiIdentityRow from "./pk_multi_identity_table";
-export { PkMultiIdentityRow };
import PlayerRow from "./player_table";
export { PlayerRow };
-import PointsRow from "./points_table";
-export { PointsRow };
-import PrivateTableRow from "./private_table_table";
-export { PrivateTableRow };
-import RepeatingTestArgRow from "./repeating_test_arg_table";
-export { RepeatingTestArgRow };
-import TableToRemoveRow from "./table_to_remove_table";
-export { TableToRemoveRow };
-import TestARow from "./test_a_table";
-export { TestARow };
import TestDRow from "./test_d_table";
export { TestDRow };
-import TestERow from "./test_e_table";
-export { TestERow };
import TestFRow from "./test_f_table";
export { TestFRow };
@@ -343,13 +310,6 @@ export { NamespaceTestF };
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
const tablesSchema = __schema(
- __table({
- name: 'has_special_stuff',
- indexes: [
- ],
- constraints: [
- ],
- }, HasSpecialStuffRow),
__table({
name: 'logged_out_player',
indexes: [
@@ -383,21 +343,6 @@ const tablesSchema = __schema(
{ name: 'person_id_key', constraint: 'unique', columns: ['id'] },
],
}, PersonRow),
- __table({
- name: 'pk_multi_identity',
- indexes: [
- { name: 'id', algorithm: 'btree', columns: [
- 'id',
- ] },
- { name: 'other', algorithm: 'btree', columns: [
- 'other',
- ] },
- ],
- constraints: [
- { name: 'pk_multi_identity_id_key', constraint: 'unique', columns: ['id'] },
- { name: 'pk_multi_identity_other_key', constraint: 'unique', columns: ['other'] },
- ],
- }, PkMultiIdentityRow),
__table({
name: 'player',
indexes: [
@@ -417,52 +362,6 @@ const tablesSchema = __schema(
{ name: 'player_player_id_key', constraint: 'unique', columns: ['playerId'] },
],
}, PlayerRow),
- __table({
- name: 'points',
- indexes: [
- { name: 'multi_column_index', algorithm: 'btree', columns: [
- 'x',
- 'y',
- ] },
- ],
- constraints: [
- ],
- }, PointsRow),
- __table({
- name: 'private_table',
- indexes: [
- ],
- constraints: [
- ],
- }, PrivateTableRow),
- __table({
- name: 'repeating_test_arg',
- indexes: [
- { name: 'scheduled_id', algorithm: 'btree', columns: [
- 'scheduledId',
- ] },
- ],
- constraints: [
- { name: 'repeating_test_arg_scheduled_id_key', constraint: 'unique', columns: ['scheduledId'] },
- ],
- }, RepeatingTestArgRow),
- __table({
- name: 'table_to_remove',
- indexes: [
- ],
- constraints: [
- ],
- }, TableToRemoveRow),
- __table({
- name: 'test_a',
- indexes: [
- { name: 'foo', algorithm: 'btree', columns: [
- 'x',
- ] },
- ],
- constraints: [
- ],
- }, TestARow),
__table({
name: 'test_d',
indexes: [
@@ -470,20 +369,6 @@ const tablesSchema = __schema(
constraints: [
],
}, TestDRow),
- __table({
- name: 'test_e',
- indexes: [
- { name: 'id', algorithm: 'btree', columns: [
- 'id',
- ] },
- { name: 'name', algorithm: 'btree', columns: [
- 'name',
- ] },
- ],
- constraints: [
- { name: 'test_e_id_key', constraint: 'unique', columns: ['id'] },
- ],
- }, TestERow),
__table({
name: 'test_f',
indexes: [
@@ -732,24 +617,6 @@ export default __t.object("Person", {
});
-'''
-"pk_multi_identity_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- id: __t.u32().primaryKey(),
- other: __t.u32(),
-});
'''
"pk_multi_identity_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -830,41 +697,6 @@ export default __t.object("Point", {
});
-'''
-"points_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- x: __t.i64(),
- y: __t.i64(),
-});
-'''
-"private_table_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- name: __t.string(),
-});
'''
"private_table_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -918,25 +750,6 @@ export default __t.object("RemoveTable", {
});
-'''
-"repeating_test_arg_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- scheduledId: __t.u64().primaryKey().name("scheduled_id"),
- scheduledAt: __t.scheduleAt().name("scheduled_at"),
- prevTime: __t.timestamp().name("prev_time"),
-});
'''
"repeating_test_arg_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
@@ -1009,42 +822,6 @@ import {
export const params = {
};
export const returnType = __t.unit()'''
-"table_to_remove_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- id: __t.u32(),
-});
-'''
-"test_a_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- x: __t.u32(),
- y: __t.u32(),
- z: __t.string(),
-});
-'''
"test_a_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
@@ -1143,24 +920,6 @@ export default __t.object("TestD", {
});
-'''
-"test_e_table.ts" = '''
-// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
-// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-
-/* eslint-disable */
-/* tslint:disable */
-import {
- TypeBuilder as __TypeBuilder,
- t as __t,
- type AlgebraicTypeType as __AlgebraicTypeType,
- type Infer as __Infer,
-} from "spacetimedb";
-
-export default __t.row({
- id: __t.u64().primaryKey(),
- name: __t.string(),
-});
'''
"test_e_type.ts" = '''
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs
index 1e684b35787..287eb2f65d2 100644
--- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs
+++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs
@@ -1,7 +1,7 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
-// This was generated using spacetimedb cli version 1.11.2 (commit 97aa69de8942102a6ea0b50dfadea3cd15e44f50).
+// This was generated using spacetimedb cli version 1.12.0 (commit 819069447d9034135872ce2bdc28722c4e5e46b6).
#nullable enable
@@ -29,18 +29,10 @@ public sealed partial class RemoteTables : RemoteTablesBase
public RemoteTables(DbConnection conn)
{
AddTable(Circle = new(conn));
- AddTable(CircleDecayTimer = new(conn));
- AddTable(CircleRecombineTimer = new(conn));
AddTable(Config = new(conn));
- AddTable(ConsumeEntityTimer = new(conn));
AddTable(Entity = new(conn));
AddTable(Food = new(conn));
- AddTable(LoggedOutCircle = new(conn));
- AddTable(LoggedOutEntity = new(conn));
- AddTable(LoggedOutPlayer = new(conn));
- AddTable(MoveAllPlayersTimer = new(conn));
AddTable(Player = new(conn));
- AddTable(SpawnFoodTimer = new(conn));
}
}
@@ -594,18 +586,10 @@ public sealed class QueryBuilder
public sealed class From
{
public global::SpacetimeDB.Table Circle() => new("circle", new CircleCols("circle"), new CircleIxCols("circle"));
- public global::SpacetimeDB.Table CircleDecayTimer() => new("circle_decay_timer", new CircleDecayTimerCols("circle_decay_timer"), new CircleDecayTimerIxCols("circle_decay_timer"));
- public global::SpacetimeDB.Table CircleRecombineTimer() => new("circle_recombine_timer", new CircleRecombineTimerCols("circle_recombine_timer"), new CircleRecombineTimerIxCols("circle_recombine_timer"));
public global::SpacetimeDB.Table Config() => new("config", new ConfigCols("config"), new ConfigIxCols("config"));
- public global::SpacetimeDB.Table ConsumeEntityTimer() => new("consume_entity_timer", new ConsumeEntityTimerCols("consume_entity_timer"), new ConsumeEntityTimerIxCols("consume_entity_timer"));
public global::SpacetimeDB.Table Entity() => new("entity", new EntityCols("entity"), new EntityIxCols("entity"));
public global::SpacetimeDB.Table Food() => new("food", new FoodCols("food"), new FoodIxCols("food"));
- public global::SpacetimeDB.Table LoggedOutCircle() => new("logged_out_circle", new LoggedOutCircleCols("logged_out_circle"), new LoggedOutCircleIxCols("logged_out_circle"));
- public global::SpacetimeDB.Table LoggedOutEntity() => new("logged_out_entity", new LoggedOutEntityCols("logged_out_entity"), new LoggedOutEntityIxCols("logged_out_entity"));
- public global::SpacetimeDB.Table LoggedOutPlayer() => new("logged_out_player", new LoggedOutPlayerCols("logged_out_player"), new LoggedOutPlayerIxCols("logged_out_player"));
- public global::SpacetimeDB.Table MoveAllPlayersTimer() => new("move_all_players_timer", new MoveAllPlayersTimerCols("move_all_players_timer"), new MoveAllPlayersTimerIxCols("move_all_players_timer"));
public global::SpacetimeDB.Table Player() => new("player", new PlayerCols("player"), new PlayerIxCols("player"));
- public global::SpacetimeDB.Table SpawnFoodTimer() => new("spawn_food_timer", new SpawnFoodTimerCols("spawn_food_timer"), new SpawnFoodTimerIxCols("spawn_food_timer"));
}
public sealed class TypedSubscriptionBuilder
diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs
deleted file mode 100644
index 09cd0b1053b..00000000000
--- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.Types
-{
- public sealed partial class RemoteTables
- {
- public sealed class CircleDecayTimerHandle : RemoteTableHandle
- {
- protected override string RemoteTableName => "circle_decay_timer";
-
- public sealed class ScheduledIdUniqueIndex : UniqueIndexBase