diff --git a/.gitattributes b/.gitattributes index a10c0188d..c2317a3a1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -**/module_bindings/** linguist-generated=true +**/module_bindings/** linguist-generated=true eol=lf diff --git a/crates/bindings-csharp/Codegen/Module.cs b/crates/bindings-csharp/Codegen/Module.cs index a9a7c443a..769e1ebed 100644 --- a/crates/bindings-csharp/Codegen/Module.cs +++ b/crates/bindings-csharp/Codegen/Module.cs @@ -271,8 +271,13 @@ public class Module : IIncrementalGenerator tableNames.Combine(addReducers), (context, tuple) => { - var tableNames = tuple.Left; - var addReducers = tuple.Right; + // Sort tables and reducers by name to match Rust behaviour. + // Not really important outside of testing, but for testing + // it matters because we commit module-bindings + // so they need to match 1:1 between different langs. + var tableNames = tuple.Left.Sort(); + var addReducers = tuple.Right.Sort((a, b) => a.Name.CompareTo(b.Name)); + // Don't generate the FFI boilerplate if there are no tables or reducers. if (tableNames.IsEmpty && addReducers.IsEmpty) return; context.AddSource( diff --git a/crates/cli/src/subcommands/publish.rs b/crates/cli/src/subcommands/publish.rs index c48ce447c..2b332c711 100644 --- a/crates/cli/src/subcommands/publish.rs +++ b/crates/cli/src/subcommands/publish.rs @@ -137,7 +137,11 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E query_params.push(("trace_log", "true")); } - let path_to_wasm = crate::tasks::build(path_to_project, skip_clippy, build_debug)?; + let path_to_wasm = if !path_to_project.is_dir() && path_to_project.extension().map_or(false, |ext| ext == "wasm") { + path_to_project.clone() + } else { + crate::tasks::build(path_to_project, skip_clippy, build_debug)? + }; let program_bytes = fs::read(path_to_wasm)?; println!( "Uploading to {} => {}", diff --git a/crates/sdk/tests/test-counter/src/lib.rs b/crates/sdk/tests/test-counter/src/lib.rs index 760575fd7..ba2080ab1 100644 --- a/crates/sdk/tests/test-counter/src/lib.rs +++ b/crates/sdk/tests/test-counter/src/lib.rs @@ -56,7 +56,7 @@ impl TestCounter { let lock = self.inner.lock().expect("TestCounterInner Mutex is poisoned"); let (lock, timeout_result) = self .wait_until_done - .wait_timeout_while(lock, Duration::from_secs(5), |inner| { + .wait_timeout_while(lock, Duration::from_secs(30), |inner| { inner.outcomes.len() != inner.registered.len() }) .expect("TestCounterInner Mutex is poisoned"); diff --git a/crates/sdk/tests/test.rs b/crates/sdk/tests/test.rs index e0b47a928..6c12c3632 100644 --- a/crates/sdk/tests/test.rs +++ b/crates/sdk/tests/test.rs @@ -1,141 +1,139 @@ -use spacetimedb_testing::sdk::Test; +macro_rules! declare_tests_with_suffix { + ($lang:ident, $suffix:literal) => { + mod $lang { + use spacetimedb_testing::sdk::Test; -const MODULE: &str = "sdk-test"; -const CLIENT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/test-client"); + const MODULE: &str = concat!("sdk-test", $suffix); + const CLIENT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/test-client"); -fn make_test(subcommand: &str) -> Test { - Test::builder() - .with_name(subcommand) - .with_module(MODULE) - .with_client(CLIENT) - .with_language("rust") - .with_bindings_dir("src/module_bindings") - .with_compile_command("cargo build") - .with_run_command(format!("cargo run -- {}", subcommand)) - .build() + fn make_test(subcommand: &str) -> Test { + Test::builder() + .with_name(subcommand) + .with_module(MODULE) + .with_client(CLIENT) + .with_language("rust") + .with_bindings_dir("src/module_bindings") + .with_compile_command("cargo build") + .with_run_command(format!("cargo run -- {}", subcommand)) + .build() + } + + #[test] + fn insert_primitive() { + make_test("insert_primitive").run(); + } + + #[test] + fn delete_primitive() { + make_test("delete_primitive").run(); + } + + #[test] + fn update_primitive() { + make_test("update_primitive").run(); + } + + #[test] + fn insert_identity() { + make_test("insert_identity").run(); + } + + #[test] + fn delete_identity() { + make_test("delete_identity").run(); + } + + #[test] + fn update_identity() { + make_test("delete_identity").run(); + } + + #[test] + fn insert_address() { + make_test("insert_address").run(); + } + + #[test] + fn delete_address() { + make_test("delete_address").run(); + } + + #[test] + fn update_address() { + make_test("delete_address").run(); + } + + #[test] + fn on_reducer() { + make_test("on_reducer").run(); + } + + #[test] + fn fail_reducer() { + make_test("fail_reducer").run(); + } + + #[test] + fn insert_vec() { + make_test("insert_vec").run(); + } + + #[test] + fn insert_simple_enum() { + make_test("insert_simple_enum").run(); + } + + #[test] + fn insert_enum_with_payload() { + make_test("insert_enum_with_payload").run(); + } + + #[test] + fn insert_long_table() { + make_test("insert_long_table").run(); + } + + #[test] + fn resubscribe() { + make_test("resubscribe").run(); + } + + #[test] + #[should_panic] + fn should_fail() { + make_test("should_fail").run(); + } + + #[test] + fn reauth() { + make_test("reauth_part_1").run(); + make_test("reauth_part_2").run(); + } + + #[test] + fn reconnect_same_address() { + make_test("reconnect_same_address").run(); + } + + #[test] + fn connect_disconnect_callbacks() { + Test::builder() + .with_name(concat!("connect_disconnect_callback_", stringify!($lang))) + .with_module(concat!("sdk-test-connect-disconnect", $suffix)) + .with_client(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/connect_disconnect_client" + )) + .with_language("rust") + .with_bindings_dir("src/module_bindings") + .with_compile_command("cargo build") + .with_run_command("cargo run") + .build() + .run(); + } + } + }; } -#[test] -fn insert_primitive() { - make_test("insert_primitive").run(); -} - -#[test] -fn delete_primitive() { - make_test("delete_primitive").run(); -} - -#[test] -fn update_primitive() { - make_test("update_primitive").run(); -} - -#[test] -fn insert_identity() { - make_test("insert_identity").run(); -} - -#[test] -fn delete_identity() { - make_test("delete_identity").run(); -} - -#[test] -fn update_identity() { - make_test("delete_identity").run(); -} - -#[test] -fn insert_address() { - make_test("insert_address").run(); -} - -#[test] -fn delete_address() { - make_test("delete_address").run(); -} - -#[test] -fn update_address() { - make_test("delete_address").run(); -} - -#[test] -fn on_reducer() { - make_test("on_reducer").run(); -} - -#[test] -fn fail_reducer() { - make_test("fail_reducer").run(); -} - -#[test] -fn insert_vec() { - make_test("insert_vec").run(); -} - -#[test] -fn insert_simple_enum() { - make_test("insert_simple_enum").run(); -} - -#[test] -fn insert_enum_with_payload() { - make_test("insert_enum_with_payload").run(); -} - -#[test] -fn insert_long_table() { - make_test("insert_long_table").run(); -} - -#[test] -fn resubscribe() { - make_test("resubscribe").run(); -} - -#[test] -#[should_panic] -fn should_fail() { - make_test("should_fail").run(); -} - -#[test] -fn reauth() { - make_test("reauth_part_1").run(); - make_test("reauth_part_2").run(); -} - -#[test] -fn reconnect_same_address() { - make_test("reconnect_same_address").run(); -} - -#[test] -fn connect_disconnect_callbacks() { - Test::builder() - .with_name("connect_disconnect_callback") - .with_module("sdk-test-connect-disconnect") - .with_client(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/connect_disconnect_client")) - .with_language("rust") - .with_bindings_dir("src/module_bindings") - .with_compile_command("cargo build") - .with_run_command("cargo run") - .build() - .run(); -} - -#[test] -fn connect_disconnect_callbacks_csharp() { - Test::builder() - .with_name("connect_disconnect_callback_csharp") - .with_module("sdk-test-connect-disconnect-cs") - .with_client(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/connect_disconnect_client")) - .with_language("rust") - .with_bindings_dir("src/module_bindings") - .with_compile_command("cargo build") - .with_run_command("cargo run") - .build() - .run(); -} +declare_tests_with_suffix!(rust, ""); +declare_tests_with_suffix!(csharp, "-cs"); diff --git a/crates/testing/src/sdk.rs b/crates/testing/src/sdk.rs index 77479f805..ac4c6d9d1 100644 --- a/crates/testing/src/sdk.rs +++ b/crates/testing/src/sdk.rs @@ -1,12 +1,13 @@ use duct::cmd; use lazy_static::lazy_static; use rand::distributions::{Alphanumeric, DistString}; +use std::collections::HashMap; +use std::fs::create_dir_all; +use std::sync::Mutex; use std::thread::JoinHandle; -use std::{collections::HashSet, fs::create_dir_all, sync::Mutex}; use crate::invoke_cli; -use crate::modules::{module_path, CompilationMode, CompiledModule}; -use std::path::Path; +use crate::modules::{CompilationMode, CompiledModule}; use tempfile::TempDir; pub fn ensure_standalone_process() { @@ -34,41 +35,9 @@ pub fn ensure_standalone_process() { } } -lazy_static! { - /// An exclusive lock which ensures we only run `spacetime generate` once for each target directory. - /// - /// Without this lock, if multiple `Test`s ran concurrently in the same process - /// with the same `client_project` and `generate_subdir`, - /// the test harness would run `spacetime generate` multiple times concurrently, - /// each of which would remove and re-populate the bindings directory, - /// potentially sweeping them out from under a compile or run process. - /// - /// This lock ensures that only one `spacetime generate` process runs at a time, - /// and the `HashSet` ensures that we run `spacetime generate` only once for each output directory. - /// - /// Circumstances where this will still break: - /// - If multiple tests want to use the same client_project/generate_subdir pair, - /// but for different modules' bindings, only one module's bindings will ever be generated. - /// If you need bindings for multiple different modules, put them in different subdirs. - /// - If multiple distinct test harness processes run concurrently, - /// they will encounter the race condition described above, - /// because the `BINDINGS_GENERATED` lock is not shared between harness processes. - /// Running multiple test harness processes concurrently will break anyways - /// because each will try to run `spacetime start` as a subprocess and will therefore - /// contend over port 3000. - /// Prefer constructing multiple `Test`s and `Test::run`ing them - /// from within the same harness process. - // - // I (pgoldman 2023-09-11) considered, as an alternative to this lock, - // having `Test::run` copy the `client_project` into a fresh temporary directory. - // That would be more complicated, as we'd need to re-write dependencies - // on the client language's SpacetimeDB SDK to use a local absolute path. - // Doing so portably across all our SDK languages seemed infeasible. - static ref BINDINGS_GENERATED: Mutex> = Mutex::new(HashSet::new()); -} - pub struct Test { /// A human-readable name for this test. + #[allow(dead_code)] // TODO: should we just remove this now that it's unused? name: String, /// Must name a module in the SpacetimeDB/modules directory. @@ -107,23 +76,23 @@ impl Test { pub fn builder() -> TestBuilder { TestBuilder::default() } - pub fn run(&self) { + pub fn run(self) { ensure_standalone_process(); - let compiled = CompiledModule::compile(&self.module_name, CompilationMode::Debug); + let wasm_file = compile_module(&self.module_name); generate_bindings( &self.generate_language, - compiled.path(), + &wasm_file, &self.client_project, &self.generate_subdir, ); - compile_client(&self.compile_command, &self.client_project, &self.name); + compile_client(&self.compile_command, &self.client_project); - let db_name = publish_module(&self.module_name); + let db_name = publish_module(&wasm_file); - run_client(&self.run_command, &self.client_project, &db_name, &self.name); + run_client(&self.run_command, &self.client_project, &db_name); } } @@ -143,43 +112,96 @@ fn random_module_name() -> String { Alphanumeric.sample_string(&mut rand::thread_rng(), 16) } -fn publish_module(module: &str) -> String { +macro_rules! memoized { + (|$key:ident: $key_ty:ty| -> $value_ty:ty $body:block) => {{ + static MEMOIZED: Mutex>> = Mutex::new(None); + + MEMOIZED + .lock() + .unwrap() + .get_or_insert_with(HashMap::new) + .entry($key) + .or_insert_with_key(|$key| -> $value_ty { $body }) + .clone() + }}; +} + +// Note: this function is memoized to ensure we compile each module only once. +// Without this lock, if multiple `Test`s ran concurrently in the same process, +// the test harness would compile each module multiple times concurrently, +// which is bad both for performance reasons as well as can lead to errors +// with toolchains like .NET which don't expect parallel invocations +// of their build tools on the same project folder. +fn compile_module(module: &str) -> String { + let module = module.to_owned(); + + memoized!(|module: String| -> String { + let module = CompiledModule::compile(module, CompilationMode::Debug); + module.path().to_str().unwrap().to_owned() + }) +} + +// Note: this function does not memoize because we want each test to publish the same +// module as a separate clean database instance for isolation purposes. +fn publish_module(wasm_file: &str) -> String { let name = random_module_name(); invoke_cli(&[ "publish", + "--debug", "--project-path", - module_path(module).to_str().unwrap(), + wasm_file, "--skip_clippy", &name, ]); - name } -fn generate_bindings(language: &str, path: &Path, client_project: &str, generate_subdir: &str) { - let generate_dir = format!("{}/{}", client_project, generate_subdir); +/// Note: this function is memoized to ensure we only run `spacetime generate` once for each target directory. +/// +/// Without this lock, if multiple `Test`s ran concurrently in the same process +/// with the same `client_project` and `generate_subdir`, +/// the test harness would run `spacetime generate` multiple times concurrently, +/// each of which would remove and re-populate the bindings directory, +/// potentially sweeping them out from under a compile or run process. +/// +/// This lock ensures that only one `spacetime generate` process runs at a time, +/// and the `HashSet` ensures that we run `spacetime generate` only once for each output directory. +/// +/// Circumstances where this will still break: +/// - If multiple tests want to use the same client_project/generate_subdir pair, +/// but for different modules' bindings, only one module's bindings will ever be generated. +/// If you need bindings for multiple different modules, put them in different subdirs. +/// - If multiple distinct test harness processes run concurrently, +/// they will encounter the race condition described above, +/// because the `BINDINGS_GENERATED` lock is not shared between harness processes. +/// Running multiple test harness processes concurrently will break anyways +/// because each will try to run `spacetime start` as a subprocess and will therefore +/// contend over port 3000. +/// Prefer constructing multiple `Test`s and `Test::run`ing them +/// from within the same harness process. +// +// I (pgoldman 2023-09-11) considered, as an alternative to this lock, +// having `Test::run` copy the `client_project` into a fresh temporary directory. +// That would be more complicated, as we'd need to re-write dependencies +// on the client language's SpacetimeDB SDK to use a local absolute path. +// Doing so portably across all our SDK languages seemed infeasible. +fn generate_bindings(language: &str, wasm_file: &str, client_project: &str, generate_subdir: &str) { + let generate_dir = format!("{client_project}/{generate_subdir}"); - let mut bindings_lock = BINDINGS_GENERATED.lock().expect("BINDINGS_GENERATED Mutex is poisoned"); - - // If we've already generated bindings in this directory, - // return early. - // Otherwise, we'll hold the lock for the duration of the subprocess, - // so other tests will wait before overwriting our output. - if !bindings_lock.insert(generate_dir.clone()) { - return; - } - - create_dir_all(&generate_dir).expect("Error creating generate subdir"); - invoke_cli(&[ - "generate", - "--skip_clippy", - "--lang", - language, - "--wasm-file", - path.to_str().unwrap(), - "--out-dir", - &generate_dir, - ]); + memoized!(|generate_dir: String| -> () { + create_dir_all(generate_dir).expect("Error creating generate subdir"); + invoke_cli(&[ + "generate", + "--debug", + "--skip_clippy", + "--lang", + language, + "--wasm-file", + wasm_file, + "--out-dir", + &generate_dir, + ]); + }) } fn split_command_string(command: &str) -> (&str, Vec<&str>) { @@ -189,36 +211,44 @@ fn split_command_string(command: &str) -> (&str, Vec<&str>) { (exe, args) } -fn compile_client(compile_command: &str, client_project: &str, test_name: &str) { - let (exe, args) = split_command_string(compile_command); +// Note: this function is memoized to ensure we only compile each client once. +fn compile_client(compile_command: &str, client_project: &str) { + let client_project = client_project.to_owned(); - let output = cmd(exe, args) - .dir(client_project) - .env(TEST_CLIENT_PROJECT_ENV_VAR, client_project) - .stderr_to_stdout() - .stdout_capture() - .unchecked() - .run() - .expect("Error running compile command"); + memoized!(|client_project: String| -> () { + let (exe, args) = split_command_string(compile_command); - status_ok_or_panic(output, compile_command, test_name); + let output = cmd(exe, args) + .dir(client_project) + .env(TEST_CLIENT_PROJECT_ENV_VAR, client_project) + .stderr_to_stdout() + .stdout_capture() + .unchecked() + .run() + .expect("Error running compile command"); + + status_ok_or_panic(output, compile_command, "(compiling)"); + }) } -fn run_client(run_command: &str, client_project: &str, db_name: &str, test_name: &str) { +fn run_client(run_command: &str, client_project: &str, db_name: &str) { let (exe, args) = split_command_string(run_command); let output = cmd(exe, args) .dir(client_project) .env(TEST_CLIENT_PROJECT_ENV_VAR, client_project) .env(TEST_DB_NAME_ENV_VAR, db_name) - .env("RUST_LOG", "trace") + .env( + "RUST_LOG", + "spacetimedb=debug,spacetimedb_client_api=debug,spacetimedb_lib=debug,spacetimedb_standalone=debug", + ) .stderr_to_stdout() .stdout_capture() .unchecked() .run() .expect("Error running run command"); - status_ok_or_panic(output, run_command, test_name); + status_ok_or_panic(output, run_command, "(running)"); } #[derive(Clone, Default)] diff --git a/modules/sdk-test-cs/.gitignore b/modules/sdk-test-cs/.gitignore new file mode 100644 index 000000000..1746e3269 --- /dev/null +++ b/modules/sdk-test-cs/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/modules/sdk-test-cs/Lib.cs b/modules/sdk-test-cs/Lib.cs new file mode 100644 index 000000000..0c98b204b --- /dev/null +++ b/modules/sdk-test-cs/Lib.cs @@ -0,0 +1,1513 @@ +using SpacetimeDB.Module; +using static SpacetimeDB.Runtime; + +static partial class Module +{ + [SpacetimeDB.Type] + public enum SimpleEnum + { + Zero, + One, + Two, + } + + [SpacetimeDB.Type] + public partial struct EnumWithPayload + : SpacetimeDB.TaggedEnum<( + byte U8, + ushort U16, + uint U32, + ulong U64, + UInt128 U128, + sbyte I8, + short I16, + int I32, + long I64, + Int128 I128, + bool Bool, + float F32, + double F64, + string Str, + Identity Identity, + Address Address, + List Bytes, + List Ints, + List Strings, + List SimpleEnums + )> { } + + [SpacetimeDB.Type] + public partial struct UnitStruct { } + + [SpacetimeDB.Type] + public partial struct ByteStruct + { + public byte b; + } + + [SpacetimeDB.Type] + public partial struct EveryPrimitiveStruct + { + public byte a; + public ushort b; + public uint c; + public ulong d; + public UInt128 e; + public sbyte f; + public short g; + public int h; + public long i; + public Int128 j; + public bool k; + public float l; + public double m; + public string n; + public Identity o; + public Address p; + } + + [SpacetimeDB.Type] + public partial struct EveryVecStruct + { + public List a; + public List b; + public List c; + public List d; + public List e; + public List f; + public List g; + public List h; + public List i; + public List j; + public List k; + public List l; + public List m; + public List n; + public List o; + public List
p; + } + + [SpacetimeDB.Table] + public partial struct OneU8 + { + public byte n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_u8(byte n) + { + new OneU8 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneU16 + { + public ushort n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_u16(ushort n) + { + new OneU16 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneU32 + { + public uint n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_u32(uint n) + { + new OneU32 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneU64 + { + public ulong n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_u64(ulong n) + { + new OneU64 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneU128 + { + public UInt128 n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_u128(UInt128 n) + { + new OneU128 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneI8 + { + public sbyte n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_i8(sbyte n) + { + new OneI8 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneI16 + { + public short n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_i16(short n) + { + new OneI16 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneI32 + { + public int n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_i32(int n) + { + new OneI32 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneI64 + { + public long n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_i64(long n) + { + new OneI64 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneI128 + { + public Int128 n; + } + + [SpacetimeDB.Reducer] + public static void insert_one_i128(Int128 n) + { + new OneI128 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneBool + { + public bool b; + } + + [SpacetimeDB.Reducer] + public static void insert_one_bool(bool b) + { + new OneBool { b = b }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneF32 + { + public float f; + } + + [SpacetimeDB.Reducer] + public static void insert_one_f32(float f) + { + new OneF32 { f = f }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneF64 + { + public double f; + } + + [SpacetimeDB.Reducer] + public static void insert_one_f64(double f) + { + new OneF64 { f = f }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneString + { + public string s; + } + + [SpacetimeDB.Reducer] + public static void insert_one_string(string s) + { + new OneString { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneIdentity + { + public Identity i; + } + + [SpacetimeDB.Reducer] + public static void insert_one_identity(Identity i) + { + new OneIdentity { i = i }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneAddress + { + public Address a; + } + + [SpacetimeDB.Reducer] + public static void insert_one_address(Address a) + { + new OneAddress { a = a }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneSimpleEnum + { + public SimpleEnum e; + } + + [SpacetimeDB.Reducer] + public static void insert_one_simple_enum(SimpleEnum e) + { + new OneSimpleEnum { e = e }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneEnumWithPayload + { + public EnumWithPayload e; + } + + [SpacetimeDB.Reducer] + public static void insert_one_enum_with_payload(EnumWithPayload e) + { + new OneEnumWithPayload { e = e }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneUnitStruct + { + public UnitStruct s; + } + + [SpacetimeDB.Reducer] + public static void insert_one_unit_struct(UnitStruct s) + { + new OneUnitStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneByteStruct + { + public ByteStruct s; + } + + [SpacetimeDB.Reducer] + public static void insert_one_byte_struct(ByteStruct s) + { + new OneByteStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneEveryPrimitiveStruct + { + public EveryPrimitiveStruct s; + } + + [SpacetimeDB.Reducer] + public static void insert_one_every_primitive_struct(EveryPrimitiveStruct s) + { + new OneEveryPrimitiveStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct OneEveryVecStruct + { + public EveryVecStruct s; + } + + [SpacetimeDB.Reducer] + public static void insert_one_every_vec_struct(EveryVecStruct s) + { + new OneEveryVecStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecU8 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_u8(List n) + { + new VecU8 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecU16 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_u16(List n) + { + new VecU16 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecU32 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_u32(List n) + { + new VecU32 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecU64 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_u64(List n) + { + new VecU64 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecU128 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_u128(List n) + { + new VecU128 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecI8 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_i8(List n) + { + new VecI8 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecI16 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_i16(List n) + { + new VecI16 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecI32 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_i32(List n) + { + new VecI32 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecI64 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_i64(List n) + { + new VecI64 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecI128 + { + public List n; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_i128(List n) + { + new VecI128 { n = n }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecBool + { + public List b; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_bool(List b) + { + new VecBool { b = b }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecF32 + { + public List f; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_f32(List f) + { + new VecF32 { f = f }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecF64 + { + public List f; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_f64(List f) + { + new VecF64 { f = f }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecString + { + public List s; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_string(List s) + { + new VecString { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecIdentity + { + public List i; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_identity(List i) + { + new VecIdentity { i = i }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecAddress + { + public List
a; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_address(List
a) + { + new VecAddress { a = a }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecSimpleEnum + { + public List e; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_simple_enum(List e) + { + new VecSimpleEnum { e = e }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecEnumWithPayload + { + public List e; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_enum_with_payload(List e) + { + new VecEnumWithPayload { e = e }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecUnitStruct + { + public List s; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_unit_struct(List s) + { + new VecUnitStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecByteStruct + { + public List s; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_byte_struct(List s) + { + new VecByteStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecEveryPrimitiveStruct + { + public List s; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_every_primitive_struct(List s) + { + new VecEveryPrimitiveStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct VecEveryVecStruct + { + public List s; + } + + [SpacetimeDB.Reducer] + public static void insert_vec_every_vec_struct(List s) + { + new VecEveryVecStruct { s = s }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct UniqueU8 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public byte n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_u8(byte n, int data) + { + new UniqueU8 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_u8(byte n, int data) + { + var key = n; + UniqueU8.UpdateByn(key, new UniqueU8 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_u8(byte n) + { + UniqueU8.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueU16 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public ushort n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_u16(ushort n, int data) + { + new UniqueU16 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_u16(ushort n, int data) + { + var key = n; + UniqueU16.UpdateByn(key, new UniqueU16 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_u16(ushort n) + { + UniqueU16.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueU32 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public uint n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_u32(uint n, int data) + { + new UniqueU32 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_u32(uint n, int data) + { + var key = n; + UniqueU32.UpdateByn(key, new UniqueU32 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_u32(uint n) + { + UniqueU32.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueU64 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public ulong n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_u64(ulong n, int data) + { + new UniqueU64 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_u64(ulong n, int data) + { + var key = n; + UniqueU64.UpdateByn(key, new UniqueU64 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_u64(ulong n) + { + UniqueU64.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueU128 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public UInt128 n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_u128(UInt128 n, int data) + { + new UniqueU128 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_u128(UInt128 n, int data) + { + var key = n; + UniqueU128.UpdateByn(key, new UniqueU128 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_u128(UInt128 n) + { + UniqueU128.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueI8 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public sbyte n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_i8(sbyte n, int data) + { + new UniqueI8 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_i8(sbyte n, int data) + { + var key = n; + UniqueI8.UpdateByn(key, new UniqueI8 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_i8(sbyte n) + { + UniqueI8.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueI16 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public short n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_i16(short n, int data) + { + new UniqueI16 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_i16(short n, int data) + { + var key = n; + UniqueI16.UpdateByn(key, new UniqueI16 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_i16(short n) + { + UniqueI16.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueI32 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public int n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_i32(int n, int data) + { + new UniqueI32 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_i32(int n, int data) + { + var key = n; + UniqueI32.UpdateByn(key, new UniqueI32 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_i32(int n) + { + UniqueI32.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueI64 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public long n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_i64(long n, int data) + { + new UniqueI64 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_i64(long n, int data) + { + var key = n; + UniqueI64.UpdateByn(key, new UniqueI64 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_i64(long n) + { + UniqueI64.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueI128 + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public Int128 n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_i128(Int128 n, int data) + { + new UniqueI128 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_i128(Int128 n, int data) + { + var key = n; + UniqueI128.UpdateByn(key, new UniqueI128 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_i128(Int128 n) + { + UniqueI128.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct UniqueBool + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public bool b; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_bool(bool b, int data) + { + new UniqueBool { b = b, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_bool(bool b, int data) + { + var key = b; + UniqueBool.UpdateByb(key, new UniqueBool { b = b, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_bool(bool b) + { + UniqueBool.DeleteByb(b); + } + + [SpacetimeDB.Table] + public partial struct UniqueString + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public string s; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_string(string s, int data) + { + new UniqueString { s = s, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_string(string s, int data) + { + var key = s; + UniqueString.UpdateBys(key, new UniqueString { s = s, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_string(string s) + { + UniqueString.DeleteBys(s); + } + + [SpacetimeDB.Table] + public partial struct UniqueIdentity + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public Identity i; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_identity(Identity i, int data) + { + new UniqueIdentity { i = i, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_identity(Identity i, int data) + { + var key = i; + UniqueIdentity.UpdateByi(key, new UniqueIdentity { i = i, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_identity(Identity i) + { + UniqueIdentity.DeleteByi(i); + } + + [SpacetimeDB.Table] + public partial struct UniqueAddress + { + [SpacetimeDB.Column(ColumnAttrs.Unique)] + public Address a; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_unique_address(Address a, int data) + { + new UniqueAddress { a = a, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_unique_address(Address a, int data) + { + var key = a; + UniqueAddress.UpdateBya(key, new UniqueAddress { a = a, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_unique_address(Address a) + { + UniqueAddress.DeleteBya(a); + } + + [SpacetimeDB.Table] + public partial struct PkU8 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public byte n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_u8(byte n, int data) + { + new PkU8 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_u8(byte n, int data) + { + var key = n; + PkU8.UpdateByn(key, new PkU8 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_u8(byte n) + { + PkU8.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkU16 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public ushort n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_u16(ushort n, int data) + { + new PkU16 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_u16(ushort n, int data) + { + var key = n; + PkU16.UpdateByn(key, new PkU16 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_u16(ushort n) + { + PkU16.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkU32 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public uint n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_u32(uint n, int data) + { + new PkU32 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_u32(uint n, int data) + { + var key = n; + PkU32.UpdateByn(key, new PkU32 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_u32(uint n) + { + PkU32.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkU64 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public ulong n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_u64(ulong n, int data) + { + new PkU64 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_u64(ulong n, int data) + { + var key = n; + PkU64.UpdateByn(key, new PkU64 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_u64(ulong n) + { + PkU64.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkU128 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public UInt128 n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_u128(UInt128 n, int data) + { + new PkU128 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_u128(UInt128 n, int data) + { + var key = n; + PkU128.UpdateByn(key, new PkU128 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_u128(UInt128 n) + { + PkU128.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkI8 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public sbyte n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_i8(sbyte n, int data) + { + new PkI8 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_i8(sbyte n, int data) + { + var key = n; + PkI8.UpdateByn(key, new PkI8 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_i8(sbyte n) + { + PkI8.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkI16 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public short n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_i16(short n, int data) + { + new PkI16 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_i16(short n, int data) + { + var key = n; + PkI16.UpdateByn(key, new PkI16 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_i16(short n) + { + PkI16.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkI32 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public int n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_i32(int n, int data) + { + new PkI32 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_i32(int n, int data) + { + var key = n; + PkI32.UpdateByn(key, new PkI32 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_i32(int n) + { + PkI32.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkI64 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public long n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_i64(long n, int data) + { + new PkI64 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_i64(long n, int data) + { + var key = n; + PkI64.UpdateByn(key, new PkI64 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_i64(long n) + { + PkI64.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkI128 + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public Int128 n; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_i128(Int128 n, int data) + { + new PkI128 { n = n, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_i128(Int128 n, int data) + { + var key = n; + PkI128.UpdateByn(key, new PkI128 { n = n, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_i128(Int128 n) + { + PkI128.DeleteByn(n); + } + + [SpacetimeDB.Table] + public partial struct PkBool + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public bool b; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_bool(bool b, int data) + { + new PkBool { b = b, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_bool(bool b, int data) + { + var key = b; + PkBool.UpdateByb(key, new PkBool { b = b, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_bool(bool b) + { + PkBool.DeleteByb(b); + } + + [SpacetimeDB.Table] + public partial struct PkString + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public string s; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_string(string s, int data) + { + new PkString { s = s, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_string(string s, int data) + { + var key = s; + PkString.UpdateBys(key, new PkString { s = s, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_string(string s) + { + PkString.DeleteBys(s); + } + + [SpacetimeDB.Table] + public partial struct PkIdentity + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public Identity i; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_identity(Identity i, int data) + { + new PkIdentity { i = i, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_identity(Identity i, int data) + { + var key = i; + PkIdentity.UpdateByi(key, new PkIdentity { i = i, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_identity(Identity i) + { + PkIdentity.DeleteByi(i); + } + + [SpacetimeDB.Table] + public partial struct PkAddress + { + [SpacetimeDB.Column(ColumnAttrs.PrimaryKey)] + public Address a; + public int data; + } + + [SpacetimeDB.Reducer] + public static void insert_pk_address(Address a, int data) + { + new PkAddress { a = a, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void update_pk_address(Address a, int data) + { + var key = a; + PkAddress.UpdateBya(key, new PkAddress { a = a, data = data }); + } + + [SpacetimeDB.Reducer] + public static void delete_pk_address(Address a) + { + PkAddress.DeleteBya(a); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_one_identity(DbEventArgs ctx) + { + new OneIdentity { i = ctx.Sender }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_vec_identity(DbEventArgs ctx) + { + new VecIdentity { i = new List { ctx.Sender } }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_unique_identity(DbEventArgs ctx, int data) + { + new UniqueIdentity { i = ctx.Sender, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_pk_identity(DbEventArgs ctx, int data) + { + new PkIdentity { i = ctx.Sender, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_one_address(DbEventArgs ctx) + { + new OneAddress { a = (Address)ctx.Address!, }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_vec_address(DbEventArgs ctx) + { + // VecAddress::insert(VecAddress { + // < a[_]>::into_vec( + // #[rustc_box] + // ::alloc::boxed::Box::new([ctx.Address.context("No address in reducer context")?]), + // ), + // }); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_unique_address(DbEventArgs ctx, int data) + { + new UniqueAddress { a = (Address)ctx.Address!, data = data }.Insert(); + } + + [SpacetimeDB.Reducer] + public static void insert_caller_pk_address(DbEventArgs ctx, int data) + { + new PkAddress { a = (Address)ctx.Address!, data = data }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct LargeTable + { + public byte a; + public ushort b; + public uint c; + public ulong d; + public UInt128 e; + public sbyte f; + public short g; + public int h; + public long i; + public Int128 j; + public bool k; + public float l; + public double m; + public string n; + public SimpleEnum o; + public EnumWithPayload p; + public UnitStruct q; + public ByteStruct r; + public EveryPrimitiveStruct s; + public EveryVecStruct t; + } + + [SpacetimeDB.Reducer] + public static void insert_large_table( + byte a, + ushort b, + uint c, + ulong d, + UInt128 e, + sbyte f, + short g, + int h, + long i, + Int128 j, + bool k, + float l, + double m, + string n, + SimpleEnum o, + EnumWithPayload p, + UnitStruct q, + ByteStruct r, + EveryPrimitiveStruct s, + EveryVecStruct t + ) + { + new LargeTable + { + a = a, + b = b, + c = c, + d = d, + e = e, + f = f, + g = g, + h = h, + i = i, + j = j, + k = k, + l = l, + m = m, + n = n, + o = o, + p = p, + q = q, + r = r, + s = s, + t = t, + }.Insert(); + } + + [SpacetimeDB.Table] + public partial struct TableHoldsTable + { + public OneU8 a; + public VecU8 b; + } + + [SpacetimeDB.Reducer] + public static void insert_table_holds_table(OneU8 a, VecU8 b) + { + new TableHoldsTable { a = a, b = b }.Insert(); + } +} diff --git a/modules/sdk-test-cs/StdbModule.csproj b/modules/sdk-test-cs/StdbModule.csproj new file mode 100644 index 000000000..e39f3a521 --- /dev/null +++ b/modules/sdk-test-cs/StdbModule.csproj @@ -0,0 +1,27 @@ + + + + + Exe + net8.0 + wasi-wasm + enable + enable + 1 + true + true + false + true + + + + + + + + +