diff --git a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-bad-ext.json b/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-bad-ext.json deleted file mode 100644 index 60a03753..00000000 --- a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-bad-ext.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "next_user_id": 2, - "users_by_username": { - "phone_00000002": { - "user": { - "id": "user_00000001", - "public_user_code": "SY-00000001", - "username": "phone_00000002", - "display_name": "138****8111", - "phone_number_masked": "138****8111", - "login_method": "Phone", - "binding_status": "Active", - "wechat_bound": false, - "token_version": 1 - }, - "password_hash": "$argon2id$v=19$m=19456,t=2,p=1$qnArSgOrZvcQxap4KAMMnA$+K+gQgf7h0jQibJLuvAlOeHnNNYutTvLVDAyo1hqS/o", - "password_login_enabled": false, - "phone_number": "+8613800138111" - } - }, - "phone_to_user_id": { - "+8613800138111": "user_00000001" - }, - "sessions_by_id": {}, - "session_id_by_refresh_token_hash": {}, - "wechat_identity_by_provider_uid": {}, - "user_id_by_provider_union_id": {} -} \ No newline at end of file diff --git a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-large-base64.json b/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-large-base64.json deleted file mode 100644 index c89a57a3..00000000 --- a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-large-base64.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "next_user_id": 2, - "users_by_username": { - "phone_00000002": { - "user": { - "id": "user_00000001", - "public_user_code": "SY-00000001", - "username": "phone_00000002", - "display_name": "138****8112", - "phone_number_masked": "138****8112", - "login_method": "Phone", - "binding_status": "Active", - "wechat_bound": false, - "token_version": 1 - }, - "password_hash": "$argon2id$v=19$m=19456,t=2,p=1$0HR2g/fKOw9EFHz7BuYtGg$cpXb5KBwbEXPxPJHA4Bk1U7NtM97GhGTq7VK6jCJ+lA", - "password_login_enabled": false, - "phone_number": "+8613800138112" - } - }, - "phone_to_user_id": { - "+8613800138112": "user_00000001" - }, - "sessions_by_id": {}, - "session_id_by_refresh_token_hash": {}, - "wechat_identity_by_provider_uid": {}, - "user_id_by_provider_union_id": {} -} \ No newline at end of file diff --git a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-ok.json b/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-ok.json deleted file mode 100644 index 14249074..00000000 --- a/server-rs/crates/api-server/.codex-temp/api-server-auth-store-creation-doc-ok.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "next_user_id": 2, - "users_by_username": { - "phone_00000002": { - "user": { - "id": "user_00000001", - "public_user_code": "SY-00000001", - "username": "phone_00000002", - "display_name": "138****8110", - "phone_number_masked": "138****8110", - "login_method": "Phone", - "binding_status": "Active", - "wechat_bound": false, - "token_version": 1 - }, - "password_hash": "$argon2id$v=19$m=19456,t=2,p=1$fEeSrVyialDeb8rarDSpdA$HFihZiuCOyaz8F5iNukmobeiHI/EpYWdeQzhbIYR4zk", - "password_login_enabled": false, - "phone_number": "+8613800138110" - } - }, - "phone_to_user_id": { - "+8613800138110": "user_00000001" - }, - "sessions_by_id": {}, - "session_id_by_refresh_token_hash": {}, - "wechat_identity_by_provider_uid": {}, - "user_id_by_provider_union_id": {} -} \ No newline at end of file diff --git a/server-rs/crates/spacetime-client/README.md b/server-rs/crates/spacetime-client/README.md index 49ac93b3..5cf534a7 100644 --- a/server-rs/crates/spacetime-client/README.md +++ b/server-rs/crates/spacetime-client/README.md @@ -37,6 +37,38 @@ 2. 不允许对该目录执行 `rustfmt`,避免把 CLI 原始输出改写成额外格式化噪音。 3. `src/lib.rs` 已通过 `#[rustfmt::skip] pub mod module_bindings;` 显式阻止 workspace 级 `cargo fmt` 继续递归格式化该目录。 +### 2.1.1 绑定缺文件恢复流程 + +若 `mod.rs` 已声明 `*_table` 模块,但目录内缺少对应 `*_table.rs` 文件,说明 Rust bindings 刷新不完整。不要手工补 generated code,统一在仓库根目录执行: + +```powershell +spacetime generate --no-config --lang rust --include-private --out-dir .\server-rs\crates\spacetime-client\src\module_bindings --module-path .\server-rs\crates\spacetime-module --yes +``` + +这里必须带 `--no-config`:仓库根目录的 `spacetime.json` 同时配置了 TypeScript 与 Rust 两个生成目标,直接追加 `--lang` / `--out-dir` 会触发 SpacetimeDB CLI 的多目标参数冲突。 + +生成后用以下命令确认 `mod.rs` 声明的模块都有落盘文件: + +```powershell +$modFile = 'server-rs\crates\spacetime-client\src\module_bindings\mod.rs' +$dir = 'server-rs\crates\spacetime-client\src\module_bindings' +$mods = Select-String -Path $modFile -Pattern '^pub mod ([a-zA-Z0-9_]+);' | + ForEach-Object { $_.Matches[0].Groups[1].Value } +$missing = @() +foreach ($m in $mods) { + if (-not (Test-Path (Join-Path $dir ($m + '.rs')))) { + $missing += $m + } +} +if ($missing.Count -eq 0) { 'missing module files: 0' } else { $missing } +``` + +最后至少执行: + +```powershell +cargo check -p spacetime-client --manifest-path server-rs\Cargo.toml +``` + ## 3. 边界约束 1. `spacetime-client` 只承接 SpacetimeDB 客户端访问适配,不承接具体业务模块的规则实现。 diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs new file mode 100644 index 00000000..6a648b5b --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs @@ -0,0 +1,164 @@ +// 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::ai_result_reference_type::AiResultReference; +use super::ai_result_reference_kind_type::AiResultReferenceKind; + +/// Table handle for the table `ai_result_reference`. +/// +/// Obtain a handle from the [`AiResultReferenceTableAccess::ai_result_reference`] method on [`super::RemoteTables`], +/// like `ctx.db.ai_result_reference()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.ai_result_reference().on_insert(...)`. +pub struct AiResultReferenceTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `ai_result_reference`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AiResultReferenceTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AiResultReferenceTableHandle`], which mediates access to the table `ai_result_reference`. + fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_>; +} + +impl AiResultReferenceTableAccess for super::RemoteTables { + fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_> { + AiResultReferenceTableHandle { + imp: self.imp.get_table::("ai_result_reference"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AiResultReferenceInsertCallbackId(__sdk::CallbackId); +pub struct AiResultReferenceDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AiResultReferenceTableHandle<'ctx> { + type Row = AiResultReference; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AiResultReferenceInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiResultReferenceInsertCallbackId { + AiResultReferenceInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AiResultReferenceInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AiResultReferenceDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiResultReferenceDeleteCallbackId { + AiResultReferenceDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AiResultReferenceDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AiResultReferenceUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AiResultReferenceTableHandle<'ctx> { + type UpdateCallbackId = AiResultReferenceUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AiResultReferenceUpdateCallbackId { + AiResultReferenceUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AiResultReferenceUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`, + /// which allows point queries on the field of the same name + /// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`. + pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AiResultReferenceTableHandle<'ctx> { + /// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`. + pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> { + AiResultReferenceResultReferenceRowIdUnique { + imp: self.imp.get_unique_constraint::("result_reference_row_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> { + /// Find the subscribed row whose `result_reference_row_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("ai_result_reference"); + _table.add_unique_constraint::("result_reference_row_id", |row| &row.result_reference_row_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AiResultReference`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait ai_result_referenceQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AiResultReference`. + fn ai_result_reference(&self) -> __sdk::__query_builder::Table; + } + + impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor { + fn ai_result_reference(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("ai_result_reference") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs new file mode 100644 index 00000000..ae1617de --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs @@ -0,0 +1,165 @@ +// 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::ai_task_stage_type::AiTaskStage; +use super::ai_task_stage_kind_type::AiTaskStageKind; +use super::ai_task_stage_status_type::AiTaskStageStatus; + +/// Table handle for the table `ai_task_stage`. +/// +/// Obtain a handle from the [`AiTaskStageTableAccess::ai_task_stage`] method on [`super::RemoteTables`], +/// like `ctx.db.ai_task_stage()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.ai_task_stage().on_insert(...)`. +pub struct AiTaskStageTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `ai_task_stage`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AiTaskStageTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AiTaskStageTableHandle`], which mediates access to the table `ai_task_stage`. + fn ai_task_stage(&self) -> AiTaskStageTableHandle<'_>; +} + +impl AiTaskStageTableAccess for super::RemoteTables { + fn ai_task_stage(&self) -> AiTaskStageTableHandle<'_> { + AiTaskStageTableHandle { + imp: self.imp.get_table::("ai_task_stage"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AiTaskStageInsertCallbackId(__sdk::CallbackId); +pub struct AiTaskStageDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AiTaskStageTableHandle<'ctx> { + type Row = AiTaskStage; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AiTaskStageInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTaskStageInsertCallbackId { + AiTaskStageInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AiTaskStageInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AiTaskStageDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTaskStageDeleteCallbackId { + AiTaskStageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AiTaskStageDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AiTaskStageUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskStageTableHandle<'ctx> { + type UpdateCallbackId = AiTaskStageUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AiTaskStageUpdateCallbackId { + AiTaskStageUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AiTaskStageUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `task_stage_id` unique index on the table `ai_task_stage`, + /// which allows point queries on the field of the same name + /// via the [`AiTaskStageTaskStageIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.ai_task_stage().task_stage_id().find(...)`. + pub struct AiTaskStageTaskStageIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AiTaskStageTableHandle<'ctx> { + /// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`. + pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> { + AiTaskStageTaskStageIdUnique { + imp: self.imp.get_unique_constraint::("task_stage_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> { + /// Find the subscribed row whose `task_stage_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("ai_task_stage"); + _table.add_unique_constraint::("task_stage_id", |row| &row.task_stage_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AiTaskStage`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait ai_task_stageQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AiTaskStage`. + fn ai_task_stage(&self) -> __sdk::__query_builder::Table; + } + + impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor { + fn ai_task_stage(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("ai_task_stage") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs new file mode 100644 index 00000000..60172196 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs @@ -0,0 +1,165 @@ +// 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::ai_task_type::AiTask; +use super::ai_task_kind_type::AiTaskKind; +use super::ai_task_status_type::AiTaskStatus; + +/// Table handle for the table `ai_task`. +/// +/// Obtain a handle from the [`AiTaskTableAccess::ai_task`] method on [`super::RemoteTables`], +/// like `ctx.db.ai_task()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.ai_task().on_insert(...)`. +pub struct AiTaskTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `ai_task`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AiTaskTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AiTaskTableHandle`], which mediates access to the table `ai_task`. + fn ai_task(&self) -> AiTaskTableHandle<'_>; +} + +impl AiTaskTableAccess for super::RemoteTables { + fn ai_task(&self) -> AiTaskTableHandle<'_> { + AiTaskTableHandle { + imp: self.imp.get_table::("ai_task"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AiTaskInsertCallbackId(__sdk::CallbackId); +pub struct AiTaskDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AiTaskTableHandle<'ctx> { + type Row = AiTask; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AiTaskInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTaskInsertCallbackId { + AiTaskInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AiTaskInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AiTaskDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTaskDeleteCallbackId { + AiTaskDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AiTaskDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AiTaskUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskTableHandle<'ctx> { + type UpdateCallbackId = AiTaskUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AiTaskUpdateCallbackId { + AiTaskUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AiTaskUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `task_id` unique index on the table `ai_task`, + /// which allows point queries on the field of the same name + /// via the [`AiTaskTaskIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.ai_task().task_id().find(...)`. + pub struct AiTaskTaskIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AiTaskTableHandle<'ctx> { + /// Get a handle on the `task_id` unique index on the table `ai_task`. + pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> { + AiTaskTaskIdUnique { + imp: self.imp.get_unique_constraint::("task_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AiTaskTaskIdUnique<'ctx> { + /// Find the subscribed row whose `task_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("ai_task"); + _table.add_unique_constraint::("task_id", |row| &row.task_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AiTask`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait ai_taskQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AiTask`. + fn ai_task(&self) -> __sdk::__query_builder::Table; + } + + impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor { + fn ai_task(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("ai_task") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs new file mode 100644 index 00000000..2ef5c6ad --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs @@ -0,0 +1,164 @@ +// 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::ai_text_chunk_type::AiTextChunk; +use super::ai_task_stage_kind_type::AiTaskStageKind; + +/// Table handle for the table `ai_text_chunk`. +/// +/// Obtain a handle from the [`AiTextChunkTableAccess::ai_text_chunk`] method on [`super::RemoteTables`], +/// like `ctx.db.ai_text_chunk()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.ai_text_chunk().on_insert(...)`. +pub struct AiTextChunkTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `ai_text_chunk`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AiTextChunkTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AiTextChunkTableHandle`], which mediates access to the table `ai_text_chunk`. + fn ai_text_chunk(&self) -> AiTextChunkTableHandle<'_>; +} + +impl AiTextChunkTableAccess for super::RemoteTables { + fn ai_text_chunk(&self) -> AiTextChunkTableHandle<'_> { + AiTextChunkTableHandle { + imp: self.imp.get_table::("ai_text_chunk"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AiTextChunkInsertCallbackId(__sdk::CallbackId); +pub struct AiTextChunkDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AiTextChunkTableHandle<'ctx> { + type Row = AiTextChunk; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AiTextChunkInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTextChunkInsertCallbackId { + AiTextChunkInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AiTextChunkInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AiTextChunkDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AiTextChunkDeleteCallbackId { + AiTextChunkDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AiTextChunkDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AiTextChunkUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AiTextChunkTableHandle<'ctx> { + type UpdateCallbackId = AiTextChunkUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AiTextChunkUpdateCallbackId { + AiTextChunkUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AiTextChunkUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`, + /// which allows point queries on the field of the same name + /// via the [`AiTextChunkTextChunkRowIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`. + pub struct AiTextChunkTextChunkRowIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AiTextChunkTableHandle<'ctx> { + /// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`. + pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> { + AiTextChunkTextChunkRowIdUnique { + imp: self.imp.get_unique_constraint::("text_chunk_row_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> { + /// Find the subscribed row whose `text_chunk_row_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("ai_text_chunk"); + _table.add_unique_constraint::("text_chunk_row_id", |row| &row.text_chunk_row_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AiTextChunk`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait ai_text_chunkQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AiTextChunk`. + fn ai_text_chunk(&self) -> __sdk::__query_builder::Table; + } + + impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor { + fn ai_text_chunk(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("ai_text_chunk") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs new file mode 100644 index 00000000..13f7b47f --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs @@ -0,0 +1,163 @@ +// 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::asset_entity_binding_type::AssetEntityBinding; + +/// Table handle for the table `asset_entity_binding`. +/// +/// Obtain a handle from the [`AssetEntityBindingTableAccess::asset_entity_binding`] method on [`super::RemoteTables`], +/// like `ctx.db.asset_entity_binding()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.asset_entity_binding().on_insert(...)`. +pub struct AssetEntityBindingTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `asset_entity_binding`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AssetEntityBindingTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AssetEntityBindingTableHandle`], which mediates access to the table `asset_entity_binding`. + fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_>; +} + +impl AssetEntityBindingTableAccess for super::RemoteTables { + fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_> { + AssetEntityBindingTableHandle { + imp: self.imp.get_table::("asset_entity_binding"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AssetEntityBindingInsertCallbackId(__sdk::CallbackId); +pub struct AssetEntityBindingDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AssetEntityBindingTableHandle<'ctx> { + type Row = AssetEntityBinding; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AssetEntityBindingInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AssetEntityBindingInsertCallbackId { + AssetEntityBindingInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AssetEntityBindingInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AssetEntityBindingDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AssetEntityBindingDeleteCallbackId { + AssetEntityBindingDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AssetEntityBindingDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AssetEntityBindingUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AssetEntityBindingTableHandle<'ctx> { + type UpdateCallbackId = AssetEntityBindingUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AssetEntityBindingUpdateCallbackId { + AssetEntityBindingUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AssetEntityBindingUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `binding_id` unique index on the table `asset_entity_binding`, + /// which allows point queries on the field of the same name + /// via the [`AssetEntityBindingBindingIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.asset_entity_binding().binding_id().find(...)`. + pub struct AssetEntityBindingBindingIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AssetEntityBindingTableHandle<'ctx> { + /// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`. + pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> { + AssetEntityBindingBindingIdUnique { + imp: self.imp.get_unique_constraint::("binding_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> { + /// Find the subscribed row whose `binding_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("asset_entity_binding"); + _table.add_unique_constraint::("binding_id", |row| &row.binding_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AssetEntityBinding`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait asset_entity_bindingQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AssetEntityBinding`. + fn asset_entity_binding(&self) -> __sdk::__query_builder::Table; + } + + impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor { + fn asset_entity_binding(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("asset_entity_binding") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs new file mode 100644 index 00000000..2aeb9a22 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs @@ -0,0 +1,164 @@ +// 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::asset_object_type::AssetObject; +use super::asset_object_access_policy_type::AssetObjectAccessPolicy; + +/// Table handle for the table `asset_object`. +/// +/// Obtain a handle from the [`AssetObjectTableAccess::asset_object`] method on [`super::RemoteTables`], +/// like `ctx.db.asset_object()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.asset_object().on_insert(...)`. +pub struct AssetObjectTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `asset_object`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AssetObjectTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AssetObjectTableHandle`], which mediates access to the table `asset_object`. + fn asset_object(&self) -> AssetObjectTableHandle<'_>; +} + +impl AssetObjectTableAccess for super::RemoteTables { + fn asset_object(&self) -> AssetObjectTableHandle<'_> { + AssetObjectTableHandle { + imp: self.imp.get_table::("asset_object"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AssetObjectInsertCallbackId(__sdk::CallbackId); +pub struct AssetObjectDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AssetObjectTableHandle<'ctx> { + type Row = AssetObject; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AssetObjectInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AssetObjectInsertCallbackId { + AssetObjectInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AssetObjectInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AssetObjectDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AssetObjectDeleteCallbackId { + AssetObjectDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AssetObjectDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AssetObjectUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AssetObjectTableHandle<'ctx> { + type UpdateCallbackId = AssetObjectUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AssetObjectUpdateCallbackId { + AssetObjectUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AssetObjectUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `asset_object_id` unique index on the table `asset_object`, + /// which allows point queries on the field of the same name + /// via the [`AssetObjectAssetObjectIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.asset_object().asset_object_id().find(...)`. + pub struct AssetObjectAssetObjectIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AssetObjectTableHandle<'ctx> { + /// Get a handle on the `asset_object_id` unique index on the table `asset_object`. + pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> { + AssetObjectAssetObjectIdUnique { + imp: self.imp.get_unique_constraint::("asset_object_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> { + /// Find the subscribed row whose `asset_object_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("asset_object"); + _table.add_unique_constraint::("asset_object_id", |row| &row.asset_object_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AssetObject`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait asset_objectQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AssetObject`. + fn asset_object(&self) -> __sdk::__query_builder::Table; + } + + impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor { + fn asset_object(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("asset_object") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs new file mode 100644 index 00000000..07644b31 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs @@ -0,0 +1,163 @@ +// 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::auth_identity_type::AuthIdentity; + +/// Table handle for the table `auth_identity`. +/// +/// Obtain a handle from the [`AuthIdentityTableAccess::auth_identity`] method on [`super::RemoteTables`], +/// like `ctx.db.auth_identity()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.auth_identity().on_insert(...)`. +pub struct AuthIdentityTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `auth_identity`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AuthIdentityTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AuthIdentityTableHandle`], which mediates access to the table `auth_identity`. + fn auth_identity(&self) -> AuthIdentityTableHandle<'_>; +} + +impl AuthIdentityTableAccess for super::RemoteTables { + fn auth_identity(&self) -> AuthIdentityTableHandle<'_> { + AuthIdentityTableHandle { + imp: self.imp.get_table::("auth_identity"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AuthIdentityInsertCallbackId(__sdk::CallbackId); +pub struct AuthIdentityDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AuthIdentityTableHandle<'ctx> { + type Row = AuthIdentity; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AuthIdentityInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AuthIdentityInsertCallbackId { + AuthIdentityInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AuthIdentityInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AuthIdentityDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AuthIdentityDeleteCallbackId { + AuthIdentityDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AuthIdentityDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AuthIdentityUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AuthIdentityTableHandle<'ctx> { + type UpdateCallbackId = AuthIdentityUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AuthIdentityUpdateCallbackId { + AuthIdentityUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AuthIdentityUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `identity_id` unique index on the table `auth_identity`, + /// which allows point queries on the field of the same name + /// via the [`AuthIdentityIdentityIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.auth_identity().identity_id().find(...)`. + pub struct AuthIdentityIdentityIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AuthIdentityTableHandle<'ctx> { + /// Get a handle on the `identity_id` unique index on the table `auth_identity`. + pub fn identity_id(&self) -> AuthIdentityIdentityIdUnique<'ctx> { + AuthIdentityIdentityIdUnique { + imp: self.imp.get_unique_constraint::("identity_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AuthIdentityIdentityIdUnique<'ctx> { + /// Find the subscribed row whose `identity_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("auth_identity"); + _table.add_unique_constraint::("identity_id", |row| &row.identity_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AuthIdentity`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait auth_identityQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AuthIdentity`. + fn auth_identity(&self) -> __sdk::__query_builder::Table; + } + + impl auth_identityQueryTableAccess for __sdk::QueryTableAccessor { + fn auth_identity(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("auth_identity") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs new file mode 100644 index 00000000..2d9cf56f --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs @@ -0,0 +1,163 @@ +// 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::auth_store_snapshot_type::AuthStoreSnapshot; + +/// Table handle for the table `auth_store_snapshot`. +/// +/// Obtain a handle from the [`AuthStoreSnapshotTableAccess::auth_store_snapshot`] method on [`super::RemoteTables`], +/// like `ctx.db.auth_store_snapshot()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.auth_store_snapshot().on_insert(...)`. +pub struct AuthStoreSnapshotTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `auth_store_snapshot`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait AuthStoreSnapshotTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`AuthStoreSnapshotTableHandle`], which mediates access to the table `auth_store_snapshot`. + fn auth_store_snapshot(&self) -> AuthStoreSnapshotTableHandle<'_>; +} + +impl AuthStoreSnapshotTableAccess for super::RemoteTables { + fn auth_store_snapshot(&self) -> AuthStoreSnapshotTableHandle<'_> { + AuthStoreSnapshotTableHandle { + imp: self.imp.get_table::("auth_store_snapshot"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct AuthStoreSnapshotInsertCallbackId(__sdk::CallbackId); +pub struct AuthStoreSnapshotDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for AuthStoreSnapshotTableHandle<'ctx> { + type Row = AuthStoreSnapshot; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = AuthStoreSnapshotInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AuthStoreSnapshotInsertCallbackId { + AuthStoreSnapshotInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: AuthStoreSnapshotInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = AuthStoreSnapshotDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> AuthStoreSnapshotDeleteCallbackId { + AuthStoreSnapshotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: AuthStoreSnapshotDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct AuthStoreSnapshotUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for AuthStoreSnapshotTableHandle<'ctx> { + type UpdateCallbackId = AuthStoreSnapshotUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> AuthStoreSnapshotUpdateCallbackId { + AuthStoreSnapshotUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: AuthStoreSnapshotUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `snapshot_id` unique index on the table `auth_store_snapshot`, + /// which allows point queries on the field of the same name + /// via the [`AuthStoreSnapshotSnapshotIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.auth_store_snapshot().snapshot_id().find(...)`. + pub struct AuthStoreSnapshotSnapshotIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> AuthStoreSnapshotTableHandle<'ctx> { + /// Get a handle on the `snapshot_id` unique index on the table `auth_store_snapshot`. + pub fn snapshot_id(&self) -> AuthStoreSnapshotSnapshotIdUnique<'ctx> { + AuthStoreSnapshotSnapshotIdUnique { + imp: self.imp.get_unique_constraint::("snapshot_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> AuthStoreSnapshotSnapshotIdUnique<'ctx> { + /// Find the subscribed row whose `snapshot_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("auth_store_snapshot"); + _table.add_unique_constraint::("snapshot_id", |row| &row.snapshot_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `AuthStoreSnapshot`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait auth_store_snapshotQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `AuthStoreSnapshot`. + fn auth_store_snapshot(&self) -> __sdk::__query_builder::Table; + } + + impl auth_store_snapshotQueryTableAccess for __sdk::QueryTableAccessor { + fn auth_store_snapshot(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("auth_store_snapshot") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs new file mode 100644 index 00000000..53dc1ebb --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs @@ -0,0 +1,167 @@ +// 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::battle_state_type::BattleState; +use super::battle_mode_type::BattleMode; +use super::battle_status_type::BattleStatus; +use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot; +use super::combat_outcome_type::CombatOutcome; + +/// Table handle for the table `battle_state`. +/// +/// Obtain a handle from the [`BattleStateTableAccess::battle_state`] method on [`super::RemoteTables`], +/// like `ctx.db.battle_state()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.battle_state().on_insert(...)`. +pub struct BattleStateTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `battle_state`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait BattleStateTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`BattleStateTableHandle`], which mediates access to the table `battle_state`. + fn battle_state(&self) -> BattleStateTableHandle<'_>; +} + +impl BattleStateTableAccess for super::RemoteTables { + fn battle_state(&self) -> BattleStateTableHandle<'_> { + BattleStateTableHandle { + imp: self.imp.get_table::("battle_state"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct BattleStateInsertCallbackId(__sdk::CallbackId); +pub struct BattleStateDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> { + type Row = BattleState; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = BattleStateInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BattleStateInsertCallbackId { + BattleStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: BattleStateInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = BattleStateDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BattleStateDeleteCallbackId { + BattleStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: BattleStateDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct BattleStateUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> { + type UpdateCallbackId = BattleStateUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> BattleStateUpdateCallbackId { + BattleStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: BattleStateUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `battle_state_id` unique index on the table `battle_state`, + /// which allows point queries on the field of the same name + /// via the [`BattleStateBattleStateIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.battle_state().battle_state_id().find(...)`. + pub struct BattleStateBattleStateIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> BattleStateTableHandle<'ctx> { + /// Get a handle on the `battle_state_id` unique index on the table `battle_state`. + pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> { + BattleStateBattleStateIdUnique { + imp: self.imp.get_unique_constraint::("battle_state_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> BattleStateBattleStateIdUnique<'ctx> { + /// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("battle_state"); + _table.add_unique_constraint::("battle_state_id", |row| &row.battle_state_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `BattleState`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait battle_stateQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `BattleState`. + fn battle_state(&self) -> __sdk::__query_builder::Table; + } + + impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor { + fn battle_state(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("battle_state") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs new file mode 100644 index 00000000..59185a0b --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs @@ -0,0 +1,165 @@ +// 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::big_fish_agent_message_type::BigFishAgentMessage; +use super::big_fish_agent_message_role_type::BigFishAgentMessageRole; +use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind; + +/// Table handle for the table `big_fish_agent_message`. +/// +/// Obtain a handle from the [`BigFishAgentMessageTableAccess::big_fish_agent_message`] method on [`super::RemoteTables`], +/// like `ctx.db.big_fish_agent_message()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.big_fish_agent_message().on_insert(...)`. +pub struct BigFishAgentMessageTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `big_fish_agent_message`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait BigFishAgentMessageTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`BigFishAgentMessageTableHandle`], which mediates access to the table `big_fish_agent_message`. + fn big_fish_agent_message(&self) -> BigFishAgentMessageTableHandle<'_>; +} + +impl BigFishAgentMessageTableAccess for super::RemoteTables { + fn big_fish_agent_message(&self) -> BigFishAgentMessageTableHandle<'_> { + BigFishAgentMessageTableHandle { + imp: self.imp.get_table::("big_fish_agent_message"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct BigFishAgentMessageInsertCallbackId(__sdk::CallbackId); +pub struct BigFishAgentMessageDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for BigFishAgentMessageTableHandle<'ctx> { + type Row = BigFishAgentMessage; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = BigFishAgentMessageInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishAgentMessageInsertCallbackId { + BigFishAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: BigFishAgentMessageInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = BigFishAgentMessageDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishAgentMessageDeleteCallbackId { + BigFishAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: BigFishAgentMessageDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct BigFishAgentMessageUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for BigFishAgentMessageTableHandle<'ctx> { + type UpdateCallbackId = BigFishAgentMessageUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> BigFishAgentMessageUpdateCallbackId { + BigFishAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: BigFishAgentMessageUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `message_id` unique index on the table `big_fish_agent_message`, + /// which allows point queries on the field of the same name + /// via the [`BigFishAgentMessageMessageIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.big_fish_agent_message().message_id().find(...)`. + pub struct BigFishAgentMessageMessageIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> BigFishAgentMessageTableHandle<'ctx> { + /// Get a handle on the `message_id` unique index on the table `big_fish_agent_message`. + pub fn message_id(&self) -> BigFishAgentMessageMessageIdUnique<'ctx> { + BigFishAgentMessageMessageIdUnique { + imp: self.imp.get_unique_constraint::("message_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> BigFishAgentMessageMessageIdUnique<'ctx> { + /// Find the subscribed row whose `message_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("big_fish_agent_message"); + _table.add_unique_constraint::("message_id", |row| &row.message_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `BigFishAgentMessage`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait big_fish_agent_messageQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `BigFishAgentMessage`. + fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table; + } + + impl big_fish_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { + fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("big_fish_agent_message") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs new file mode 100644 index 00000000..8b296390 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs @@ -0,0 +1,165 @@ +// 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::big_fish_asset_slot_type::BigFishAssetSlot; +use super::big_fish_asset_kind_type::BigFishAssetKind; +use super::big_fish_asset_status_type::BigFishAssetStatus; + +/// Table handle for the table `big_fish_asset_slot`. +/// +/// Obtain a handle from the [`BigFishAssetSlotTableAccess::big_fish_asset_slot`] method on [`super::RemoteTables`], +/// like `ctx.db.big_fish_asset_slot()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.big_fish_asset_slot().on_insert(...)`. +pub struct BigFishAssetSlotTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `big_fish_asset_slot`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait BigFishAssetSlotTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`BigFishAssetSlotTableHandle`], which mediates access to the table `big_fish_asset_slot`. + fn big_fish_asset_slot(&self) -> BigFishAssetSlotTableHandle<'_>; +} + +impl BigFishAssetSlotTableAccess for super::RemoteTables { + fn big_fish_asset_slot(&self) -> BigFishAssetSlotTableHandle<'_> { + BigFishAssetSlotTableHandle { + imp: self.imp.get_table::("big_fish_asset_slot"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct BigFishAssetSlotInsertCallbackId(__sdk::CallbackId); +pub struct BigFishAssetSlotDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for BigFishAssetSlotTableHandle<'ctx> { + type Row = BigFishAssetSlot; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = BigFishAssetSlotInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishAssetSlotInsertCallbackId { + BigFishAssetSlotInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: BigFishAssetSlotInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = BigFishAssetSlotDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishAssetSlotDeleteCallbackId { + BigFishAssetSlotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: BigFishAssetSlotDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct BigFishAssetSlotUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for BigFishAssetSlotTableHandle<'ctx> { + type UpdateCallbackId = BigFishAssetSlotUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> BigFishAssetSlotUpdateCallbackId { + BigFishAssetSlotUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: BigFishAssetSlotUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `slot_id` unique index on the table `big_fish_asset_slot`, + /// which allows point queries on the field of the same name + /// via the [`BigFishAssetSlotSlotIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.big_fish_asset_slot().slot_id().find(...)`. + pub struct BigFishAssetSlotSlotIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> BigFishAssetSlotTableHandle<'ctx> { + /// Get a handle on the `slot_id` unique index on the table `big_fish_asset_slot`. + pub fn slot_id(&self) -> BigFishAssetSlotSlotIdUnique<'ctx> { + BigFishAssetSlotSlotIdUnique { + imp: self.imp.get_unique_constraint::("slot_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> BigFishAssetSlotSlotIdUnique<'ctx> { + /// Find the subscribed row whose `slot_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("big_fish_asset_slot"); + _table.add_unique_constraint::("slot_id", |row| &row.slot_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `BigFishAssetSlot`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait big_fish_asset_slotQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `BigFishAssetSlot`. + fn big_fish_asset_slot(&self) -> __sdk::__query_builder::Table; + } + + impl big_fish_asset_slotQueryTableAccess for __sdk::QueryTableAccessor { + fn big_fish_asset_slot(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("big_fish_asset_slot") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs new file mode 100644 index 00000000..3eff808d --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs @@ -0,0 +1,164 @@ +// 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::big_fish_creation_session_type::BigFishCreationSession; +use super::big_fish_creation_stage_type::BigFishCreationStage; + +/// Table handle for the table `big_fish_creation_session`. +/// +/// Obtain a handle from the [`BigFishCreationSessionTableAccess::big_fish_creation_session`] method on [`super::RemoteTables`], +/// like `ctx.db.big_fish_creation_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.big_fish_creation_session().on_insert(...)`. +pub struct BigFishCreationSessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `big_fish_creation_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait BigFishCreationSessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`BigFishCreationSessionTableHandle`], which mediates access to the table `big_fish_creation_session`. + fn big_fish_creation_session(&self) -> BigFishCreationSessionTableHandle<'_>; +} + +impl BigFishCreationSessionTableAccess for super::RemoteTables { + fn big_fish_creation_session(&self) -> BigFishCreationSessionTableHandle<'_> { + BigFishCreationSessionTableHandle { + imp: self.imp.get_table::("big_fish_creation_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct BigFishCreationSessionInsertCallbackId(__sdk::CallbackId); +pub struct BigFishCreationSessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for BigFishCreationSessionTableHandle<'ctx> { + type Row = BigFishCreationSession; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = BigFishCreationSessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishCreationSessionInsertCallbackId { + BigFishCreationSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: BigFishCreationSessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = BigFishCreationSessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishCreationSessionDeleteCallbackId { + BigFishCreationSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: BigFishCreationSessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct BigFishCreationSessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for BigFishCreationSessionTableHandle<'ctx> { + type UpdateCallbackId = BigFishCreationSessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> BigFishCreationSessionUpdateCallbackId { + BigFishCreationSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: BigFishCreationSessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `session_id` unique index on the table `big_fish_creation_session`, + /// which allows point queries on the field of the same name + /// via the [`BigFishCreationSessionSessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.big_fish_creation_session().session_id().find(...)`. + pub struct BigFishCreationSessionSessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> BigFishCreationSessionTableHandle<'ctx> { + /// Get a handle on the `session_id` unique index on the table `big_fish_creation_session`. + pub fn session_id(&self) -> BigFishCreationSessionSessionIdUnique<'ctx> { + BigFishCreationSessionSessionIdUnique { + imp: self.imp.get_unique_constraint::("session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> BigFishCreationSessionSessionIdUnique<'ctx> { + /// Find the subscribed row whose `session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("big_fish_creation_session"); + _table.add_unique_constraint::("session_id", |row| &row.session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `BigFishCreationSession`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait big_fish_creation_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `BigFishCreationSession`. + fn big_fish_creation_session(&self) -> __sdk::__query_builder::Table; + } + + impl big_fish_creation_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn big_fish_creation_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("big_fish_creation_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs new file mode 100644 index 00000000..9ed2da19 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs @@ -0,0 +1,164 @@ +// 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::big_fish_runtime_run_type::BigFishRuntimeRun; +use super::big_fish_run_status_type::BigFishRunStatus; + +/// Table handle for the table `big_fish_runtime_run`. +/// +/// Obtain a handle from the [`BigFishRuntimeRunTableAccess::big_fish_runtime_run`] method on [`super::RemoteTables`], +/// like `ctx.db.big_fish_runtime_run()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.big_fish_runtime_run().on_insert(...)`. +pub struct BigFishRuntimeRunTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `big_fish_runtime_run`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait BigFishRuntimeRunTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`BigFishRuntimeRunTableHandle`], which mediates access to the table `big_fish_runtime_run`. + fn big_fish_runtime_run(&self) -> BigFishRuntimeRunTableHandle<'_>; +} + +impl BigFishRuntimeRunTableAccess for super::RemoteTables { + fn big_fish_runtime_run(&self) -> BigFishRuntimeRunTableHandle<'_> { + BigFishRuntimeRunTableHandle { + imp: self.imp.get_table::("big_fish_runtime_run"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct BigFishRuntimeRunInsertCallbackId(__sdk::CallbackId); +pub struct BigFishRuntimeRunDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for BigFishRuntimeRunTableHandle<'ctx> { + type Row = BigFishRuntimeRun; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = BigFishRuntimeRunInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishRuntimeRunInsertCallbackId { + BigFishRuntimeRunInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: BigFishRuntimeRunInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = BigFishRuntimeRunDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> BigFishRuntimeRunDeleteCallbackId { + BigFishRuntimeRunDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: BigFishRuntimeRunDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct BigFishRuntimeRunUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for BigFishRuntimeRunTableHandle<'ctx> { + type UpdateCallbackId = BigFishRuntimeRunUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> BigFishRuntimeRunUpdateCallbackId { + BigFishRuntimeRunUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: BigFishRuntimeRunUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `run_id` unique index on the table `big_fish_runtime_run`, + /// which allows point queries on the field of the same name + /// via the [`BigFishRuntimeRunRunIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.big_fish_runtime_run().run_id().find(...)`. + pub struct BigFishRuntimeRunRunIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> BigFishRuntimeRunTableHandle<'ctx> { + /// Get a handle on the `run_id` unique index on the table `big_fish_runtime_run`. + pub fn run_id(&self) -> BigFishRuntimeRunRunIdUnique<'ctx> { + BigFishRuntimeRunRunIdUnique { + imp: self.imp.get_unique_constraint::("run_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> BigFishRuntimeRunRunIdUnique<'ctx> { + /// Find the subscribed row whose `run_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("big_fish_runtime_run"); + _table.add_unique_constraint::("run_id", |row| &row.run_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `BigFishRuntimeRun`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait big_fish_runtime_runQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `BigFishRuntimeRun`. + fn big_fish_runtime_run(&self) -> __sdk::__query_builder::Table; + } + + impl big_fish_runtime_runQueryTableAccess for __sdk::QueryTableAccessor { + fn big_fish_runtime_run(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("big_fish_runtime_run") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs new file mode 100644 index 00000000..5bd5c38c --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs @@ -0,0 +1,164 @@ +// 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::chapter_progression_type::ChapterProgression; +use super::chapter_pace_band_type::ChapterPaceBand; + +/// Table handle for the table `chapter_progression`. +/// +/// Obtain a handle from the [`ChapterProgressionTableAccess::chapter_progression`] method on [`super::RemoteTables`], +/// like `ctx.db.chapter_progression()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.chapter_progression().on_insert(...)`. +pub struct ChapterProgressionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `chapter_progression`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait ChapterProgressionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`ChapterProgressionTableHandle`], which mediates access to the table `chapter_progression`. + fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_>; +} + +impl ChapterProgressionTableAccess for super::RemoteTables { + fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_> { + ChapterProgressionTableHandle { + imp: self.imp.get_table::("chapter_progression"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct ChapterProgressionInsertCallbackId(__sdk::CallbackId); +pub struct ChapterProgressionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for ChapterProgressionTableHandle<'ctx> { + type Row = ChapterProgression; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = ChapterProgressionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ChapterProgressionInsertCallbackId { + ChapterProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: ChapterProgressionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = ChapterProgressionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ChapterProgressionDeleteCallbackId { + ChapterProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: ChapterProgressionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct ChapterProgressionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for ChapterProgressionTableHandle<'ctx> { + type UpdateCallbackId = ChapterProgressionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> ChapterProgressionUpdateCallbackId { + ChapterProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: ChapterProgressionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `chapter_progression_id` unique index on the table `chapter_progression`, + /// which allows point queries on the field of the same name + /// via the [`ChapterProgressionChapterProgressionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.chapter_progression().chapter_progression_id().find(...)`. + pub struct ChapterProgressionChapterProgressionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> ChapterProgressionTableHandle<'ctx> { + /// Get a handle on the `chapter_progression_id` unique index on the table `chapter_progression`. + pub fn chapter_progression_id(&self) -> ChapterProgressionChapterProgressionIdUnique<'ctx> { + ChapterProgressionChapterProgressionIdUnique { + imp: self.imp.get_unique_constraint::("chapter_progression_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> ChapterProgressionChapterProgressionIdUnique<'ctx> { + /// Find the subscribed row whose `chapter_progression_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("chapter_progression"); + _table.add_unique_constraint::("chapter_progression_id", |row| &row.chapter_progression_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `ChapterProgression`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait chapter_progressionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `ChapterProgression`. + fn chapter_progression(&self) -> __sdk::__query_builder::Table; + } + + impl chapter_progressionQueryTableAccess for __sdk::QueryTableAccessor { + fn chapter_progression(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("chapter_progression") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs new file mode 100644 index 00000000..12cae6f1 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs @@ -0,0 +1,165 @@ +// 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::custom_world_agent_message_type::CustomWorldAgentMessage; +use super::rpg_agent_message_role_type::RpgAgentMessageRole; +use super::rpg_agent_message_kind_type::RpgAgentMessageKind; + +/// Table handle for the table `custom_world_agent_message`. +/// +/// Obtain a handle from the [`CustomWorldAgentMessageTableAccess::custom_world_agent_message`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_agent_message()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_agent_message().on_insert(...)`. +pub struct CustomWorldAgentMessageTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_agent_message`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldAgentMessageTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldAgentMessageTableHandle`], which mediates access to the table `custom_world_agent_message`. + fn custom_world_agent_message(&self) -> CustomWorldAgentMessageTableHandle<'_>; +} + +impl CustomWorldAgentMessageTableAccess for super::RemoteTables { + fn custom_world_agent_message(&self) -> CustomWorldAgentMessageTableHandle<'_> { + CustomWorldAgentMessageTableHandle { + imp: self.imp.get_table::("custom_world_agent_message"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldAgentMessageInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldAgentMessageDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldAgentMessageTableHandle<'ctx> { + type Row = CustomWorldAgentMessage; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldAgentMessageInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentMessageInsertCallbackId { + CustomWorldAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldAgentMessageInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldAgentMessageDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentMessageDeleteCallbackId { + CustomWorldAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldAgentMessageDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldAgentMessageUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentMessageTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldAgentMessageUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentMessageUpdateCallbackId { + CustomWorldAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldAgentMessageUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `message_id` unique index on the table `custom_world_agent_message`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldAgentMessageMessageIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_agent_message().message_id().find(...)`. + pub struct CustomWorldAgentMessageMessageIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldAgentMessageTableHandle<'ctx> { + /// Get a handle on the `message_id` unique index on the table `custom_world_agent_message`. + pub fn message_id(&self) -> CustomWorldAgentMessageMessageIdUnique<'ctx> { + CustomWorldAgentMessageMessageIdUnique { + imp: self.imp.get_unique_constraint::("message_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldAgentMessageMessageIdUnique<'ctx> { + /// Find the subscribed row whose `message_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_agent_message"); + _table.add_unique_constraint::("message_id", |row| &row.message_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldAgentMessage`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_agent_messageQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldAgentMessage`. + fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_agent_message") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs new file mode 100644 index 00000000..7e6b6b11 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs @@ -0,0 +1,165 @@ +// 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::custom_world_agent_operation_type::CustomWorldAgentOperation; +use super::rpg_agent_operation_type_type::RpgAgentOperationType; +use super::rpg_agent_operation_status_type::RpgAgentOperationStatus; + +/// Table handle for the table `custom_world_agent_operation`. +/// +/// Obtain a handle from the [`CustomWorldAgentOperationTableAccess::custom_world_agent_operation`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_agent_operation()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_agent_operation().on_insert(...)`. +pub struct CustomWorldAgentOperationTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_agent_operation`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldAgentOperationTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldAgentOperationTableHandle`], which mediates access to the table `custom_world_agent_operation`. + fn custom_world_agent_operation(&self) -> CustomWorldAgentOperationTableHandle<'_>; +} + +impl CustomWorldAgentOperationTableAccess for super::RemoteTables { + fn custom_world_agent_operation(&self) -> CustomWorldAgentOperationTableHandle<'_> { + CustomWorldAgentOperationTableHandle { + imp: self.imp.get_table::("custom_world_agent_operation"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldAgentOperationInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldAgentOperationDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldAgentOperationTableHandle<'ctx> { + type Row = CustomWorldAgentOperation; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldAgentOperationInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentOperationInsertCallbackId { + CustomWorldAgentOperationInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldAgentOperationInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldAgentOperationDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentOperationDeleteCallbackId { + CustomWorldAgentOperationDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldAgentOperationDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldAgentOperationUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentOperationTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldAgentOperationUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentOperationUpdateCallbackId { + CustomWorldAgentOperationUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldAgentOperationUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `operation_id` unique index on the table `custom_world_agent_operation`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldAgentOperationOperationIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_agent_operation().operation_id().find(...)`. + pub struct CustomWorldAgentOperationOperationIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldAgentOperationTableHandle<'ctx> { + /// Get a handle on the `operation_id` unique index on the table `custom_world_agent_operation`. + pub fn operation_id(&self) -> CustomWorldAgentOperationOperationIdUnique<'ctx> { + CustomWorldAgentOperationOperationIdUnique { + imp: self.imp.get_unique_constraint::("operation_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldAgentOperationOperationIdUnique<'ctx> { + /// Find the subscribed row whose `operation_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_agent_operation"); + _table.add_unique_constraint::("operation_id", |row| &row.operation_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldAgentOperation`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_agent_operationQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldAgentOperation`. + fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_agent_operationQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_agent_operation") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs new file mode 100644 index 00000000..8b907a69 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs @@ -0,0 +1,164 @@ +// 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::custom_world_agent_session_type::CustomWorldAgentSession; +use super::rpg_agent_stage_type::RpgAgentStage; + +/// Table handle for the table `custom_world_agent_session`. +/// +/// Obtain a handle from the [`CustomWorldAgentSessionTableAccess::custom_world_agent_session`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_agent_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_agent_session().on_insert(...)`. +pub struct CustomWorldAgentSessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_agent_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldAgentSessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldAgentSessionTableHandle`], which mediates access to the table `custom_world_agent_session`. + fn custom_world_agent_session(&self) -> CustomWorldAgentSessionTableHandle<'_>; +} + +impl CustomWorldAgentSessionTableAccess for super::RemoteTables { + fn custom_world_agent_session(&self) -> CustomWorldAgentSessionTableHandle<'_> { + CustomWorldAgentSessionTableHandle { + imp: self.imp.get_table::("custom_world_agent_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldAgentSessionInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldAgentSessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldAgentSessionTableHandle<'ctx> { + type Row = CustomWorldAgentSession; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldAgentSessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentSessionInsertCallbackId { + CustomWorldAgentSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldAgentSessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldAgentSessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentSessionDeleteCallbackId { + CustomWorldAgentSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldAgentSessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldAgentSessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentSessionTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldAgentSessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldAgentSessionUpdateCallbackId { + CustomWorldAgentSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldAgentSessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `session_id` unique index on the table `custom_world_agent_session`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldAgentSessionSessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_agent_session().session_id().find(...)`. + pub struct CustomWorldAgentSessionSessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldAgentSessionTableHandle<'ctx> { + /// Get a handle on the `session_id` unique index on the table `custom_world_agent_session`. + pub fn session_id(&self) -> CustomWorldAgentSessionSessionIdUnique<'ctx> { + CustomWorldAgentSessionSessionIdUnique { + imp: self.imp.get_unique_constraint::("session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldAgentSessionSessionIdUnique<'ctx> { + /// Find the subscribed row whose `session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_agent_session"); + _table.add_unique_constraint::("session_id", |row| &row.session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldAgentSession`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_agent_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldAgentSession`. + fn custom_world_agent_session(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_agent_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_agent_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_agent_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs new file mode 100644 index 00000000..9d197db6 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs @@ -0,0 +1,166 @@ +// 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::custom_world_draft_card_type::CustomWorldDraftCard; +use super::rpg_agent_draft_card_kind_type::RpgAgentDraftCardKind; +use super::rpg_agent_draft_card_status_type::RpgAgentDraftCardStatus; +use super::custom_world_role_asset_status_type::CustomWorldRoleAssetStatus; + +/// Table handle for the table `custom_world_draft_card`. +/// +/// Obtain a handle from the [`CustomWorldDraftCardTableAccess::custom_world_draft_card`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_draft_card()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_draft_card().on_insert(...)`. +pub struct CustomWorldDraftCardTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_draft_card`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldDraftCardTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldDraftCardTableHandle`], which mediates access to the table `custom_world_draft_card`. + fn custom_world_draft_card(&self) -> CustomWorldDraftCardTableHandle<'_>; +} + +impl CustomWorldDraftCardTableAccess for super::RemoteTables { + fn custom_world_draft_card(&self) -> CustomWorldDraftCardTableHandle<'_> { + CustomWorldDraftCardTableHandle { + imp: self.imp.get_table::("custom_world_draft_card"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldDraftCardInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldDraftCardDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldDraftCardTableHandle<'ctx> { + type Row = CustomWorldDraftCard; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldDraftCardInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldDraftCardInsertCallbackId { + CustomWorldDraftCardInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldDraftCardInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldDraftCardDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldDraftCardDeleteCallbackId { + CustomWorldDraftCardDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldDraftCardDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldDraftCardUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldDraftCardTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldDraftCardUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldDraftCardUpdateCallbackId { + CustomWorldDraftCardUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldDraftCardUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `card_id` unique index on the table `custom_world_draft_card`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldDraftCardCardIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_draft_card().card_id().find(...)`. + pub struct CustomWorldDraftCardCardIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldDraftCardTableHandle<'ctx> { + /// Get a handle on the `card_id` unique index on the table `custom_world_draft_card`. + pub fn card_id(&self) -> CustomWorldDraftCardCardIdUnique<'ctx> { + CustomWorldDraftCardCardIdUnique { + imp: self.imp.get_unique_constraint::("card_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldDraftCardCardIdUnique<'ctx> { + /// Find the subscribed row whose `card_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_draft_card"); + _table.add_unique_constraint::("card_id", |row| &row.card_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldDraftCard`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_draft_cardQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldDraftCard`. + fn custom_world_draft_card(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_draft_cardQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_draft_card(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_draft_card") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs new file mode 100644 index 00000000..69639bf3 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs @@ -0,0 +1,165 @@ +// 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::custom_world_profile_type::CustomWorldProfile; +use super::custom_world_theme_mode_type::CustomWorldThemeMode; +use super::custom_world_publication_status_type::CustomWorldPublicationStatus; + +/// Table handle for the table `custom_world_profile`. +/// +/// Obtain a handle from the [`CustomWorldProfileTableAccess::custom_world_profile`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_profile()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_profile().on_insert(...)`. +pub struct CustomWorldProfileTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_profile`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldProfileTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldProfileTableHandle`], which mediates access to the table `custom_world_profile`. + fn custom_world_profile(&self) -> CustomWorldProfileTableHandle<'_>; +} + +impl CustomWorldProfileTableAccess for super::RemoteTables { + fn custom_world_profile(&self) -> CustomWorldProfileTableHandle<'_> { + CustomWorldProfileTableHandle { + imp: self.imp.get_table::("custom_world_profile"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldProfileInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldProfileDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldProfileTableHandle<'ctx> { + type Row = CustomWorldProfile; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldProfileInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldProfileInsertCallbackId { + CustomWorldProfileInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldProfileInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldProfileDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldProfileDeleteCallbackId { + CustomWorldProfileDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldProfileDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldProfileUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldProfileTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldProfileUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldProfileUpdateCallbackId { + CustomWorldProfileUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldProfileUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `profile_id` unique index on the table `custom_world_profile`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldProfileProfileIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_profile().profile_id().find(...)`. + pub struct CustomWorldProfileProfileIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldProfileTableHandle<'ctx> { + /// Get a handle on the `profile_id` unique index on the table `custom_world_profile`. + pub fn profile_id(&self) -> CustomWorldProfileProfileIdUnique<'ctx> { + CustomWorldProfileProfileIdUnique { + imp: self.imp.get_unique_constraint::("profile_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldProfileProfileIdUnique<'ctx> { + /// Find the subscribed row whose `profile_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_profile"); + _table.add_unique_constraint::("profile_id", |row| &row.profile_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldProfile`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_profileQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldProfile`. + fn custom_world_profile(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_profileQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_profile(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_profile") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs new file mode 100644 index 00000000..4d44d0ff --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs @@ -0,0 +1,165 @@ +// 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::custom_world_session_type::CustomWorldSession; +use super::custom_world_generation_mode_type::CustomWorldGenerationMode; +use super::custom_world_session_status_type::CustomWorldSessionStatus; + +/// Table handle for the table `custom_world_session`. +/// +/// Obtain a handle from the [`CustomWorldSessionTableAccess::custom_world_session`] method on [`super::RemoteTables`], +/// like `ctx.db.custom_world_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.custom_world_session().on_insert(...)`. +pub struct CustomWorldSessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `custom_world_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait CustomWorldSessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`CustomWorldSessionTableHandle`], which mediates access to the table `custom_world_session`. + fn custom_world_session(&self) -> CustomWorldSessionTableHandle<'_>; +} + +impl CustomWorldSessionTableAccess for super::RemoteTables { + fn custom_world_session(&self) -> CustomWorldSessionTableHandle<'_> { + CustomWorldSessionTableHandle { + imp: self.imp.get_table::("custom_world_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct CustomWorldSessionInsertCallbackId(__sdk::CallbackId); +pub struct CustomWorldSessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for CustomWorldSessionTableHandle<'ctx> { + type Row = CustomWorldSession; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = CustomWorldSessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldSessionInsertCallbackId { + CustomWorldSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: CustomWorldSessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = CustomWorldSessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> CustomWorldSessionDeleteCallbackId { + CustomWorldSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: CustomWorldSessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct CustomWorldSessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldSessionTableHandle<'ctx> { + type UpdateCallbackId = CustomWorldSessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> CustomWorldSessionUpdateCallbackId { + CustomWorldSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: CustomWorldSessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `session_id` unique index on the table `custom_world_session`, + /// which allows point queries on the field of the same name + /// via the [`CustomWorldSessionSessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.custom_world_session().session_id().find(...)`. + pub struct CustomWorldSessionSessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> CustomWorldSessionTableHandle<'ctx> { + /// Get a handle on the `session_id` unique index on the table `custom_world_session`. + pub fn session_id(&self) -> CustomWorldSessionSessionIdUnique<'ctx> { + CustomWorldSessionSessionIdUnique { + imp: self.imp.get_unique_constraint::("session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> CustomWorldSessionSessionIdUnique<'ctx> { + /// Find the subscribed row whose `session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("custom_world_session"); + _table.add_unique_constraint::("session_id", |row| &row.session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `CustomWorldSession`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait custom_world_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `CustomWorldSession`. + fn custom_world_session(&self) -> __sdk::__query_builder::Table; + } + + impl custom_world_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn custom_world_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("custom_world_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs new file mode 100644 index 00000000..da04ff99 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs @@ -0,0 +1,167 @@ +// 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::inventory_slot_type::InventorySlot; +use super::inventory_item_rarity_type::InventoryItemRarity; +use super::inventory_equipment_slot_type::InventoryEquipmentSlot; +use super::inventory_item_source_kind_type::InventoryItemSourceKind; +use super::inventory_container_kind_type::InventoryContainerKind; + +/// Table handle for the table `inventory_slot`. +/// +/// Obtain a handle from the [`InventorySlotTableAccess::inventory_slot`] method on [`super::RemoteTables`], +/// like `ctx.db.inventory_slot()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.inventory_slot().on_insert(...)`. +pub struct InventorySlotTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `inventory_slot`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait InventorySlotTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`InventorySlotTableHandle`], which mediates access to the table `inventory_slot`. + fn inventory_slot(&self) -> InventorySlotTableHandle<'_>; +} + +impl InventorySlotTableAccess for super::RemoteTables { + fn inventory_slot(&self) -> InventorySlotTableHandle<'_> { + InventorySlotTableHandle { + imp: self.imp.get_table::("inventory_slot"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct InventorySlotInsertCallbackId(__sdk::CallbackId); +pub struct InventorySlotDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for InventorySlotTableHandle<'ctx> { + type Row = InventorySlot; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = InventorySlotInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> InventorySlotInsertCallbackId { + InventorySlotInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: InventorySlotInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = InventorySlotDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> InventorySlotDeleteCallbackId { + InventorySlotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: InventorySlotDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct InventorySlotUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for InventorySlotTableHandle<'ctx> { + type UpdateCallbackId = InventorySlotUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> InventorySlotUpdateCallbackId { + InventorySlotUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: InventorySlotUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `slot_id` unique index on the table `inventory_slot`, + /// which allows point queries on the field of the same name + /// via the [`InventorySlotSlotIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.inventory_slot().slot_id().find(...)`. + pub struct InventorySlotSlotIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> InventorySlotTableHandle<'ctx> { + /// Get a handle on the `slot_id` unique index on the table `inventory_slot`. + pub fn slot_id(&self) -> InventorySlotSlotIdUnique<'ctx> { + InventorySlotSlotIdUnique { + imp: self.imp.get_unique_constraint::("slot_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> InventorySlotSlotIdUnique<'ctx> { + /// Find the subscribed row whose `slot_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("inventory_slot"); + _table.add_unique_constraint::("slot_id", |row| &row.slot_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `InventorySlot`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait inventory_slotQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `InventorySlot`. + fn inventory_slot(&self) -> __sdk::__query_builder::Table; + } + + impl inventory_slotQueryTableAccess for __sdk::QueryTableAccessor { + fn inventory_slot(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("inventory_slot") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs new file mode 100644 index 00000000..917742d6 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs @@ -0,0 +1,165 @@ +// 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::npc_state_type::NpcState; +use super::npc_relation_state_type::NpcRelationState; +use super::npc_stance_profile_type::NpcStanceProfile; + +/// Table handle for the table `npc_state`. +/// +/// Obtain a handle from the [`NpcStateTableAccess::npc_state`] method on [`super::RemoteTables`], +/// like `ctx.db.npc_state()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.npc_state().on_insert(...)`. +pub struct NpcStateTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `npc_state`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait NpcStateTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`NpcStateTableHandle`], which mediates access to the table `npc_state`. + fn npc_state(&self) -> NpcStateTableHandle<'_>; +} + +impl NpcStateTableAccess for super::RemoteTables { + fn npc_state(&self) -> NpcStateTableHandle<'_> { + NpcStateTableHandle { + imp: self.imp.get_table::("npc_state"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct NpcStateInsertCallbackId(__sdk::CallbackId); +pub struct NpcStateDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for NpcStateTableHandle<'ctx> { + type Row = NpcState; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = NpcStateInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> NpcStateInsertCallbackId { + NpcStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: NpcStateInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = NpcStateDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> NpcStateDeleteCallbackId { + NpcStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: NpcStateDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct NpcStateUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for NpcStateTableHandle<'ctx> { + type UpdateCallbackId = NpcStateUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> NpcStateUpdateCallbackId { + NpcStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: NpcStateUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `npc_state_id` unique index on the table `npc_state`, + /// which allows point queries on the field of the same name + /// via the [`NpcStateNpcStateIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.npc_state().npc_state_id().find(...)`. + pub struct NpcStateNpcStateIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> NpcStateTableHandle<'ctx> { + /// Get a handle on the `npc_state_id` unique index on the table `npc_state`. + pub fn npc_state_id(&self) -> NpcStateNpcStateIdUnique<'ctx> { + NpcStateNpcStateIdUnique { + imp: self.imp.get_unique_constraint::("npc_state_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> NpcStateNpcStateIdUnique<'ctx> { + /// Find the subscribed row whose `npc_state_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("npc_state"); + _table.add_unique_constraint::("npc_state_id", |row| &row.npc_state_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `NpcState`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait npc_stateQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `NpcState`. + fn npc_state(&self) -> __sdk::__query_builder::Table; + } + + impl npc_stateQueryTableAccess for __sdk::QueryTableAccessor { + fn npc_state(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("npc_state") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs new file mode 100644 index 00000000..27262e2f --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs @@ -0,0 +1,164 @@ +// 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::player_progression_type::PlayerProgression; +use super::player_progression_grant_source_type::PlayerProgressionGrantSource; + +/// Table handle for the table `player_progression`. +/// +/// Obtain a handle from the [`PlayerProgressionTableAccess::player_progression`] method on [`super::RemoteTables`], +/// like `ctx.db.player_progression()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.player_progression().on_insert(...)`. +pub struct PlayerProgressionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `player_progression`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait PlayerProgressionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`PlayerProgressionTableHandle`], which mediates access to the table `player_progression`. + fn player_progression(&self) -> PlayerProgressionTableHandle<'_>; +} + +impl PlayerProgressionTableAccess for super::RemoteTables { + fn player_progression(&self) -> PlayerProgressionTableHandle<'_> { + PlayerProgressionTableHandle { + imp: self.imp.get_table::("player_progression"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct PlayerProgressionInsertCallbackId(__sdk::CallbackId); +pub struct PlayerProgressionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for PlayerProgressionTableHandle<'ctx> { + type Row = PlayerProgression; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = PlayerProgressionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PlayerProgressionInsertCallbackId { + PlayerProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: PlayerProgressionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = PlayerProgressionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PlayerProgressionDeleteCallbackId { + PlayerProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: PlayerProgressionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct PlayerProgressionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for PlayerProgressionTableHandle<'ctx> { + type UpdateCallbackId = PlayerProgressionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> PlayerProgressionUpdateCallbackId { + PlayerProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: PlayerProgressionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `user_id` unique index on the table `player_progression`, + /// which allows point queries on the field of the same name + /// via the [`PlayerProgressionUserIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.player_progression().user_id().find(...)`. + pub struct PlayerProgressionUserIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> PlayerProgressionTableHandle<'ctx> { + /// Get a handle on the `user_id` unique index on the table `player_progression`. + pub fn user_id(&self) -> PlayerProgressionUserIdUnique<'ctx> { + PlayerProgressionUserIdUnique { + imp: self.imp.get_unique_constraint::("user_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> PlayerProgressionUserIdUnique<'ctx> { + /// Find the subscribed row whose `user_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("player_progression"); + _table.add_unique_constraint::("user_id", |row| &row.user_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `PlayerProgression`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait player_progressionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `PlayerProgression`. + fn player_progression(&self) -> __sdk::__query_builder::Table; + } + + impl player_progressionQueryTableAccess for __sdk::QueryTableAccessor { + fn player_progression(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("player_progression") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs new file mode 100644 index 00000000..4e1d2abd --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs @@ -0,0 +1,163 @@ +// 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::profile_dashboard_state_type::ProfileDashboardState; + +/// Table handle for the table `profile_dashboard_state`. +/// +/// Obtain a handle from the [`ProfileDashboardStateTableAccess::profile_dashboard_state`] method on [`super::RemoteTables`], +/// like `ctx.db.profile_dashboard_state()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.profile_dashboard_state().on_insert(...)`. +pub struct ProfileDashboardStateTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `profile_dashboard_state`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait ProfileDashboardStateTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`ProfileDashboardStateTableHandle`], which mediates access to the table `profile_dashboard_state`. + fn profile_dashboard_state(&self) -> ProfileDashboardStateTableHandle<'_>; +} + +impl ProfileDashboardStateTableAccess for super::RemoteTables { + fn profile_dashboard_state(&self) -> ProfileDashboardStateTableHandle<'_> { + ProfileDashboardStateTableHandle { + imp: self.imp.get_table::("profile_dashboard_state"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct ProfileDashboardStateInsertCallbackId(__sdk::CallbackId); +pub struct ProfileDashboardStateDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for ProfileDashboardStateTableHandle<'ctx> { + type Row = ProfileDashboardState; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = ProfileDashboardStateInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileDashboardStateInsertCallbackId { + ProfileDashboardStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: ProfileDashboardStateInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = ProfileDashboardStateDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileDashboardStateDeleteCallbackId { + ProfileDashboardStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: ProfileDashboardStateDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct ProfileDashboardStateUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for ProfileDashboardStateTableHandle<'ctx> { + type UpdateCallbackId = ProfileDashboardStateUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> ProfileDashboardStateUpdateCallbackId { + ProfileDashboardStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: ProfileDashboardStateUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `user_id` unique index on the table `profile_dashboard_state`, + /// which allows point queries on the field of the same name + /// via the [`ProfileDashboardStateUserIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.profile_dashboard_state().user_id().find(...)`. + pub struct ProfileDashboardStateUserIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> ProfileDashboardStateTableHandle<'ctx> { + /// Get a handle on the `user_id` unique index on the table `profile_dashboard_state`. + pub fn user_id(&self) -> ProfileDashboardStateUserIdUnique<'ctx> { + ProfileDashboardStateUserIdUnique { + imp: self.imp.get_unique_constraint::("user_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> ProfileDashboardStateUserIdUnique<'ctx> { + /// Find the subscribed row whose `user_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("profile_dashboard_state"); + _table.add_unique_constraint::("user_id", |row| &row.user_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `ProfileDashboardState`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait profile_dashboard_stateQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `ProfileDashboardState`. + fn profile_dashboard_state(&self) -> __sdk::__query_builder::Table; + } + + impl profile_dashboard_stateQueryTableAccess for __sdk::QueryTableAccessor { + fn profile_dashboard_state(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("profile_dashboard_state") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs new file mode 100644 index 00000000..944de27b --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs @@ -0,0 +1,163 @@ +// 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::profile_played_world_type::ProfilePlayedWorld; + +/// Table handle for the table `profile_played_world`. +/// +/// Obtain a handle from the [`ProfilePlayedWorldTableAccess::profile_played_world`] method on [`super::RemoteTables`], +/// like `ctx.db.profile_played_world()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.profile_played_world().on_insert(...)`. +pub struct ProfilePlayedWorldTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `profile_played_world`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait ProfilePlayedWorldTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`ProfilePlayedWorldTableHandle`], which mediates access to the table `profile_played_world`. + fn profile_played_world(&self) -> ProfilePlayedWorldTableHandle<'_>; +} + +impl ProfilePlayedWorldTableAccess for super::RemoteTables { + fn profile_played_world(&self) -> ProfilePlayedWorldTableHandle<'_> { + ProfilePlayedWorldTableHandle { + imp: self.imp.get_table::("profile_played_world"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct ProfilePlayedWorldInsertCallbackId(__sdk::CallbackId); +pub struct ProfilePlayedWorldDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for ProfilePlayedWorldTableHandle<'ctx> { + type Row = ProfilePlayedWorld; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = ProfilePlayedWorldInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfilePlayedWorldInsertCallbackId { + ProfilePlayedWorldInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: ProfilePlayedWorldInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = ProfilePlayedWorldDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfilePlayedWorldDeleteCallbackId { + ProfilePlayedWorldDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: ProfilePlayedWorldDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct ProfilePlayedWorldUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for ProfilePlayedWorldTableHandle<'ctx> { + type UpdateCallbackId = ProfilePlayedWorldUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> ProfilePlayedWorldUpdateCallbackId { + ProfilePlayedWorldUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: ProfilePlayedWorldUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `played_world_id` unique index on the table `profile_played_world`, + /// which allows point queries on the field of the same name + /// via the [`ProfilePlayedWorldPlayedWorldIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.profile_played_world().played_world_id().find(...)`. + pub struct ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> ProfilePlayedWorldTableHandle<'ctx> { + /// Get a handle on the `played_world_id` unique index on the table `profile_played_world`. + pub fn played_world_id(&self) -> ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { + ProfilePlayedWorldPlayedWorldIdUnique { + imp: self.imp.get_unique_constraint::("played_world_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { + /// Find the subscribed row whose `played_world_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("profile_played_world"); + _table.add_unique_constraint::("played_world_id", |row| &row.played_world_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `ProfilePlayedWorld`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait profile_played_worldQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `ProfilePlayedWorld`. + fn profile_played_world(&self) -> __sdk::__query_builder::Table; + } + + impl profile_played_worldQueryTableAccess for __sdk::QueryTableAccessor { + fn profile_played_world(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("profile_played_world") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs new file mode 100644 index 00000000..4d503269 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs @@ -0,0 +1,163 @@ +// 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::profile_save_archive_type::ProfileSaveArchive; + +/// Table handle for the table `profile_save_archive`. +/// +/// Obtain a handle from the [`ProfileSaveArchiveTableAccess::profile_save_archive`] method on [`super::RemoteTables`], +/// like `ctx.db.profile_save_archive()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.profile_save_archive().on_insert(...)`. +pub struct ProfileSaveArchiveTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `profile_save_archive`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait ProfileSaveArchiveTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`ProfileSaveArchiveTableHandle`], which mediates access to the table `profile_save_archive`. + fn profile_save_archive(&self) -> ProfileSaveArchiveTableHandle<'_>; +} + +impl ProfileSaveArchiveTableAccess for super::RemoteTables { + fn profile_save_archive(&self) -> ProfileSaveArchiveTableHandle<'_> { + ProfileSaveArchiveTableHandle { + imp: self.imp.get_table::("profile_save_archive"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct ProfileSaveArchiveInsertCallbackId(__sdk::CallbackId); +pub struct ProfileSaveArchiveDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for ProfileSaveArchiveTableHandle<'ctx> { + type Row = ProfileSaveArchive; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = ProfileSaveArchiveInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileSaveArchiveInsertCallbackId { + ProfileSaveArchiveInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: ProfileSaveArchiveInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = ProfileSaveArchiveDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileSaveArchiveDeleteCallbackId { + ProfileSaveArchiveDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: ProfileSaveArchiveDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct ProfileSaveArchiveUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for ProfileSaveArchiveTableHandle<'ctx> { + type UpdateCallbackId = ProfileSaveArchiveUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> ProfileSaveArchiveUpdateCallbackId { + ProfileSaveArchiveUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: ProfileSaveArchiveUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `archive_id` unique index on the table `profile_save_archive`, + /// which allows point queries on the field of the same name + /// via the [`ProfileSaveArchiveArchiveIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.profile_save_archive().archive_id().find(...)`. + pub struct ProfileSaveArchiveArchiveIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> ProfileSaveArchiveTableHandle<'ctx> { + /// Get a handle on the `archive_id` unique index on the table `profile_save_archive`. + pub fn archive_id(&self) -> ProfileSaveArchiveArchiveIdUnique<'ctx> { + ProfileSaveArchiveArchiveIdUnique { + imp: self.imp.get_unique_constraint::("archive_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> ProfileSaveArchiveArchiveIdUnique<'ctx> { + /// Find the subscribed row whose `archive_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("profile_save_archive"); + _table.add_unique_constraint::("archive_id", |row| &row.archive_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `ProfileSaveArchive`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait profile_save_archiveQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `ProfileSaveArchive`. + fn profile_save_archive(&self) -> __sdk::__query_builder::Table; + } + + impl profile_save_archiveQueryTableAccess for __sdk::QueryTableAccessor { + fn profile_save_archive(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("profile_save_archive") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs new file mode 100644 index 00000000..1dab9684 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs @@ -0,0 +1,164 @@ +// 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::profile_wallet_ledger_type::ProfileWalletLedger; +use super::runtime_profile_wallet_ledger_source_type_type::RuntimeProfileWalletLedgerSourceType; + +/// Table handle for the table `profile_wallet_ledger`. +/// +/// Obtain a handle from the [`ProfileWalletLedgerTableAccess::profile_wallet_ledger`] method on [`super::RemoteTables`], +/// like `ctx.db.profile_wallet_ledger()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.profile_wallet_ledger().on_insert(...)`. +pub struct ProfileWalletLedgerTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `profile_wallet_ledger`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait ProfileWalletLedgerTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`ProfileWalletLedgerTableHandle`], which mediates access to the table `profile_wallet_ledger`. + fn profile_wallet_ledger(&self) -> ProfileWalletLedgerTableHandle<'_>; +} + +impl ProfileWalletLedgerTableAccess for super::RemoteTables { + fn profile_wallet_ledger(&self) -> ProfileWalletLedgerTableHandle<'_> { + ProfileWalletLedgerTableHandle { + imp: self.imp.get_table::("profile_wallet_ledger"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct ProfileWalletLedgerInsertCallbackId(__sdk::CallbackId); +pub struct ProfileWalletLedgerDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for ProfileWalletLedgerTableHandle<'ctx> { + type Row = ProfileWalletLedger; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = ProfileWalletLedgerInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileWalletLedgerInsertCallbackId { + ProfileWalletLedgerInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: ProfileWalletLedgerInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = ProfileWalletLedgerDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> ProfileWalletLedgerDeleteCallbackId { + ProfileWalletLedgerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: ProfileWalletLedgerDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct ProfileWalletLedgerUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for ProfileWalletLedgerTableHandle<'ctx> { + type UpdateCallbackId = ProfileWalletLedgerUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> ProfileWalletLedgerUpdateCallbackId { + ProfileWalletLedgerUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: ProfileWalletLedgerUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `wallet_ledger_id` unique index on the table `profile_wallet_ledger`, + /// which allows point queries on the field of the same name + /// via the [`ProfileWalletLedgerWalletLedgerIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.profile_wallet_ledger().wallet_ledger_id().find(...)`. + pub struct ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> ProfileWalletLedgerTableHandle<'ctx> { + /// Get a handle on the `wallet_ledger_id` unique index on the table `profile_wallet_ledger`. + pub fn wallet_ledger_id(&self) -> ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { + ProfileWalletLedgerWalletLedgerIdUnique { + imp: self.imp.get_unique_constraint::("wallet_ledger_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { + /// Find the subscribed row whose `wallet_ledger_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("profile_wallet_ledger"); + _table.add_unique_constraint::("wallet_ledger_id", |row| &row.wallet_ledger_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `ProfileWalletLedger`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait profile_wallet_ledgerQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `ProfileWalletLedger`. + fn profile_wallet_ledger(&self) -> __sdk::__query_builder::Table; + } + + impl profile_wallet_ledgerQueryTableAccess for __sdk::QueryTableAccessor { + fn profile_wallet_ledger(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("profile_wallet_ledger") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs new file mode 100644 index 00000000..e282d9e9 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs @@ -0,0 +1,165 @@ +// 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::puzzle_agent_message_row_type::PuzzleAgentMessageRow; +use super::puzzle_agent_message_role_type::PuzzleAgentMessageRole; +use super::puzzle_agent_message_kind_type::PuzzleAgentMessageKind; + +/// Table handle for the table `puzzle_agent_message`. +/// +/// Obtain a handle from the [`PuzzleAgentMessageTableAccess::puzzle_agent_message`] method on [`super::RemoteTables`], +/// like `ctx.db.puzzle_agent_message()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.puzzle_agent_message().on_insert(...)`. +pub struct PuzzleAgentMessageTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `puzzle_agent_message`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait PuzzleAgentMessageTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`PuzzleAgentMessageTableHandle`], which mediates access to the table `puzzle_agent_message`. + fn puzzle_agent_message(&self) -> PuzzleAgentMessageTableHandle<'_>; +} + +impl PuzzleAgentMessageTableAccess for super::RemoteTables { + fn puzzle_agent_message(&self) -> PuzzleAgentMessageTableHandle<'_> { + PuzzleAgentMessageTableHandle { + imp: self.imp.get_table::("puzzle_agent_message"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct PuzzleAgentMessageInsertCallbackId(__sdk::CallbackId); +pub struct PuzzleAgentMessageDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for PuzzleAgentMessageTableHandle<'ctx> { + type Row = PuzzleAgentMessageRow; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = PuzzleAgentMessageInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleAgentMessageInsertCallbackId { + PuzzleAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: PuzzleAgentMessageInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = PuzzleAgentMessageDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleAgentMessageDeleteCallbackId { + PuzzleAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: PuzzleAgentMessageDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct PuzzleAgentMessageUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleAgentMessageTableHandle<'ctx> { + type UpdateCallbackId = PuzzleAgentMessageUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> PuzzleAgentMessageUpdateCallbackId { + PuzzleAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: PuzzleAgentMessageUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `message_id` unique index on the table `puzzle_agent_message`, + /// which allows point queries on the field of the same name + /// via the [`PuzzleAgentMessageMessageIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.puzzle_agent_message().message_id().find(...)`. + pub struct PuzzleAgentMessageMessageIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> PuzzleAgentMessageTableHandle<'ctx> { + /// Get a handle on the `message_id` unique index on the table `puzzle_agent_message`. + pub fn message_id(&self) -> PuzzleAgentMessageMessageIdUnique<'ctx> { + PuzzleAgentMessageMessageIdUnique { + imp: self.imp.get_unique_constraint::("message_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> PuzzleAgentMessageMessageIdUnique<'ctx> { + /// Find the subscribed row whose `message_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("puzzle_agent_message"); + _table.add_unique_constraint::("message_id", |row| &row.message_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `PuzzleAgentMessageRow`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait puzzle_agent_messageQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `PuzzleAgentMessageRow`. + fn puzzle_agent_message(&self) -> __sdk::__query_builder::Table; + } + + impl puzzle_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { + fn puzzle_agent_message(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("puzzle_agent_message") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs new file mode 100644 index 00000000..0272d915 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs @@ -0,0 +1,164 @@ +// 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::puzzle_agent_session_row_type::PuzzleAgentSessionRow; +use super::puzzle_agent_stage_type::PuzzleAgentStage; + +/// Table handle for the table `puzzle_agent_session`. +/// +/// Obtain a handle from the [`PuzzleAgentSessionTableAccess::puzzle_agent_session`] method on [`super::RemoteTables`], +/// like `ctx.db.puzzle_agent_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.puzzle_agent_session().on_insert(...)`. +pub struct PuzzleAgentSessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `puzzle_agent_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait PuzzleAgentSessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`PuzzleAgentSessionTableHandle`], which mediates access to the table `puzzle_agent_session`. + fn puzzle_agent_session(&self) -> PuzzleAgentSessionTableHandle<'_>; +} + +impl PuzzleAgentSessionTableAccess for super::RemoteTables { + fn puzzle_agent_session(&self) -> PuzzleAgentSessionTableHandle<'_> { + PuzzleAgentSessionTableHandle { + imp: self.imp.get_table::("puzzle_agent_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct PuzzleAgentSessionInsertCallbackId(__sdk::CallbackId); +pub struct PuzzleAgentSessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for PuzzleAgentSessionTableHandle<'ctx> { + type Row = PuzzleAgentSessionRow; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = PuzzleAgentSessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleAgentSessionInsertCallbackId { + PuzzleAgentSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: PuzzleAgentSessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = PuzzleAgentSessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleAgentSessionDeleteCallbackId { + PuzzleAgentSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: PuzzleAgentSessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct PuzzleAgentSessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleAgentSessionTableHandle<'ctx> { + type UpdateCallbackId = PuzzleAgentSessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> PuzzleAgentSessionUpdateCallbackId { + PuzzleAgentSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: PuzzleAgentSessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `session_id` unique index on the table `puzzle_agent_session`, + /// which allows point queries on the field of the same name + /// via the [`PuzzleAgentSessionSessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.puzzle_agent_session().session_id().find(...)`. + pub struct PuzzleAgentSessionSessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> PuzzleAgentSessionTableHandle<'ctx> { + /// Get a handle on the `session_id` unique index on the table `puzzle_agent_session`. + pub fn session_id(&self) -> PuzzleAgentSessionSessionIdUnique<'ctx> { + PuzzleAgentSessionSessionIdUnique { + imp: self.imp.get_unique_constraint::("session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> PuzzleAgentSessionSessionIdUnique<'ctx> { + /// Find the subscribed row whose `session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("puzzle_agent_session"); + _table.add_unique_constraint::("session_id", |row| &row.session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `PuzzleAgentSessionRow`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait puzzle_agent_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `PuzzleAgentSessionRow`. + fn puzzle_agent_session(&self) -> __sdk::__query_builder::Table; + } + + impl puzzle_agent_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn puzzle_agent_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("puzzle_agent_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs new file mode 100644 index 00000000..5447392d --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs @@ -0,0 +1,163 @@ +// 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::puzzle_runtime_run_row_type::PuzzleRuntimeRunRow; + +/// Table handle for the table `puzzle_runtime_run`. +/// +/// Obtain a handle from the [`PuzzleRuntimeRunTableAccess::puzzle_runtime_run`] method on [`super::RemoteTables`], +/// like `ctx.db.puzzle_runtime_run()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.puzzle_runtime_run().on_insert(...)`. +pub struct PuzzleRuntimeRunTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `puzzle_runtime_run`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait PuzzleRuntimeRunTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`PuzzleRuntimeRunTableHandle`], which mediates access to the table `puzzle_runtime_run`. + fn puzzle_runtime_run(&self) -> PuzzleRuntimeRunTableHandle<'_>; +} + +impl PuzzleRuntimeRunTableAccess for super::RemoteTables { + fn puzzle_runtime_run(&self) -> PuzzleRuntimeRunTableHandle<'_> { + PuzzleRuntimeRunTableHandle { + imp: self.imp.get_table::("puzzle_runtime_run"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct PuzzleRuntimeRunInsertCallbackId(__sdk::CallbackId); +pub struct PuzzleRuntimeRunDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for PuzzleRuntimeRunTableHandle<'ctx> { + type Row = PuzzleRuntimeRunRow; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = PuzzleRuntimeRunInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleRuntimeRunInsertCallbackId { + PuzzleRuntimeRunInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: PuzzleRuntimeRunInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = PuzzleRuntimeRunDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleRuntimeRunDeleteCallbackId { + PuzzleRuntimeRunDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: PuzzleRuntimeRunDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct PuzzleRuntimeRunUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleRuntimeRunTableHandle<'ctx> { + type UpdateCallbackId = PuzzleRuntimeRunUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> PuzzleRuntimeRunUpdateCallbackId { + PuzzleRuntimeRunUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: PuzzleRuntimeRunUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `run_id` unique index on the table `puzzle_runtime_run`, + /// which allows point queries on the field of the same name + /// via the [`PuzzleRuntimeRunRunIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.puzzle_runtime_run().run_id().find(...)`. + pub struct PuzzleRuntimeRunRunIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> PuzzleRuntimeRunTableHandle<'ctx> { + /// Get a handle on the `run_id` unique index on the table `puzzle_runtime_run`. + pub fn run_id(&self) -> PuzzleRuntimeRunRunIdUnique<'ctx> { + PuzzleRuntimeRunRunIdUnique { + imp: self.imp.get_unique_constraint::("run_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> PuzzleRuntimeRunRunIdUnique<'ctx> { + /// Find the subscribed row whose `run_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("puzzle_runtime_run"); + _table.add_unique_constraint::("run_id", |row| &row.run_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `PuzzleRuntimeRunRow`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait puzzle_runtime_runQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `PuzzleRuntimeRunRow`. + fn puzzle_runtime_run(&self) -> __sdk::__query_builder::Table; + } + + impl puzzle_runtime_runQueryTableAccess for __sdk::QueryTableAccessor { + fn puzzle_runtime_run(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("puzzle_runtime_run") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs new file mode 100644 index 00000000..c5f14f0f --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs @@ -0,0 +1,164 @@ +// 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::puzzle_work_profile_row_type::PuzzleWorkProfileRow; +use super::puzzle_publication_status_type::PuzzlePublicationStatus; + +/// Table handle for the table `puzzle_work_profile`. +/// +/// Obtain a handle from the [`PuzzleWorkProfileTableAccess::puzzle_work_profile`] method on [`super::RemoteTables`], +/// like `ctx.db.puzzle_work_profile()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.puzzle_work_profile().on_insert(...)`. +pub struct PuzzleWorkProfileTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `puzzle_work_profile`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait PuzzleWorkProfileTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`PuzzleWorkProfileTableHandle`], which mediates access to the table `puzzle_work_profile`. + fn puzzle_work_profile(&self) -> PuzzleWorkProfileTableHandle<'_>; +} + +impl PuzzleWorkProfileTableAccess for super::RemoteTables { + fn puzzle_work_profile(&self) -> PuzzleWorkProfileTableHandle<'_> { + PuzzleWorkProfileTableHandle { + imp: self.imp.get_table::("puzzle_work_profile"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct PuzzleWorkProfileInsertCallbackId(__sdk::CallbackId); +pub struct PuzzleWorkProfileDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for PuzzleWorkProfileTableHandle<'ctx> { + type Row = PuzzleWorkProfileRow; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = PuzzleWorkProfileInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleWorkProfileInsertCallbackId { + PuzzleWorkProfileInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: PuzzleWorkProfileInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = PuzzleWorkProfileDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> PuzzleWorkProfileDeleteCallbackId { + PuzzleWorkProfileDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: PuzzleWorkProfileDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct PuzzleWorkProfileUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleWorkProfileTableHandle<'ctx> { + type UpdateCallbackId = PuzzleWorkProfileUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> PuzzleWorkProfileUpdateCallbackId { + PuzzleWorkProfileUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: PuzzleWorkProfileUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `profile_id` unique index on the table `puzzle_work_profile`, + /// which allows point queries on the field of the same name + /// via the [`PuzzleWorkProfileProfileIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.puzzle_work_profile().profile_id().find(...)`. + pub struct PuzzleWorkProfileProfileIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> PuzzleWorkProfileTableHandle<'ctx> { + /// Get a handle on the `profile_id` unique index on the table `puzzle_work_profile`. + pub fn profile_id(&self) -> PuzzleWorkProfileProfileIdUnique<'ctx> { + PuzzleWorkProfileProfileIdUnique { + imp: self.imp.get_unique_constraint::("profile_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> PuzzleWorkProfileProfileIdUnique<'ctx> { + /// Find the subscribed row whose `profile_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("puzzle_work_profile"); + _table.add_unique_constraint::("profile_id", |row| &row.profile_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `PuzzleWorkProfileRow`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait puzzle_work_profileQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `PuzzleWorkProfileRow`. + fn puzzle_work_profile(&self) -> __sdk::__query_builder::Table; + } + + impl puzzle_work_profileQueryTableAccess for __sdk::QueryTableAccessor { + fn puzzle_work_profile(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("puzzle_work_profile") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs new file mode 100644 index 00000000..069f1084 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs @@ -0,0 +1,167 @@ +// 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::quest_log_type::QuestLog; +use super::quest_status_type::QuestStatus; +use super::quest_progress_signal_type::QuestProgressSignal; +use super::quest_log_event_kind_type::QuestLogEventKind; +use super::quest_signal_kind_type::QuestSignalKind; + +/// Table handle for the table `quest_log`. +/// +/// Obtain a handle from the [`QuestLogTableAccess::quest_log`] method on [`super::RemoteTables`], +/// like `ctx.db.quest_log()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.quest_log().on_insert(...)`. +pub struct QuestLogTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `quest_log`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait QuestLogTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`QuestLogTableHandle`], which mediates access to the table `quest_log`. + fn quest_log(&self) -> QuestLogTableHandle<'_>; +} + +impl QuestLogTableAccess for super::RemoteTables { + fn quest_log(&self) -> QuestLogTableHandle<'_> { + QuestLogTableHandle { + imp: self.imp.get_table::("quest_log"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct QuestLogInsertCallbackId(__sdk::CallbackId); +pub struct QuestLogDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for QuestLogTableHandle<'ctx> { + type Row = QuestLog; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = QuestLogInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> QuestLogInsertCallbackId { + QuestLogInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: QuestLogInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = QuestLogDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> QuestLogDeleteCallbackId { + QuestLogDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: QuestLogDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct QuestLogUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for QuestLogTableHandle<'ctx> { + type UpdateCallbackId = QuestLogUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> QuestLogUpdateCallbackId { + QuestLogUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: QuestLogUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `log_id` unique index on the table `quest_log`, + /// which allows point queries on the field of the same name + /// via the [`QuestLogLogIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.quest_log().log_id().find(...)`. + pub struct QuestLogLogIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> QuestLogTableHandle<'ctx> { + /// Get a handle on the `log_id` unique index on the table `quest_log`. + pub fn log_id(&self) -> QuestLogLogIdUnique<'ctx> { + QuestLogLogIdUnique { + imp: self.imp.get_unique_constraint::("log_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> QuestLogLogIdUnique<'ctx> { + /// Find the subscribed row whose `log_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("quest_log"); + _table.add_unique_constraint::("log_id", |row| &row.log_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `QuestLog`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait quest_logQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `QuestLog`. + fn quest_log(&self) -> __sdk::__query_builder::Table; + } + + impl quest_logQueryTableAccess for __sdk::QueryTableAccessor { + fn quest_log(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("quest_log") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs new file mode 100644 index 00000000..3ccd7a81 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs @@ -0,0 +1,168 @@ +// 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::quest_record_type::QuestRecord; +use super::quest_status_type::QuestStatus; +use super::quest_reward_snapshot_type::QuestRewardSnapshot; +use super::quest_narrative_binding_snapshot_type::QuestNarrativeBindingSnapshot; +use super::quest_step_snapshot_type::QuestStepSnapshot; +use super::quest_objective_snapshot_type::QuestObjectiveSnapshot; + +/// Table handle for the table `quest_record`. +/// +/// Obtain a handle from the [`QuestRecordTableAccess::quest_record`] method on [`super::RemoteTables`], +/// like `ctx.db.quest_record()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.quest_record().on_insert(...)`. +pub struct QuestRecordTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `quest_record`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait QuestRecordTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`QuestRecordTableHandle`], which mediates access to the table `quest_record`. + fn quest_record(&self) -> QuestRecordTableHandle<'_>; +} + +impl QuestRecordTableAccess for super::RemoteTables { + fn quest_record(&self) -> QuestRecordTableHandle<'_> { + QuestRecordTableHandle { + imp: self.imp.get_table::("quest_record"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct QuestRecordInsertCallbackId(__sdk::CallbackId); +pub struct QuestRecordDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for QuestRecordTableHandle<'ctx> { + type Row = QuestRecord; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = QuestRecordInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> QuestRecordInsertCallbackId { + QuestRecordInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: QuestRecordInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = QuestRecordDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> QuestRecordDeleteCallbackId { + QuestRecordDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: QuestRecordDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct QuestRecordUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for QuestRecordTableHandle<'ctx> { + type UpdateCallbackId = QuestRecordUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> QuestRecordUpdateCallbackId { + QuestRecordUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: QuestRecordUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `quest_id` unique index on the table `quest_record`, + /// which allows point queries on the field of the same name + /// via the [`QuestRecordQuestIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.quest_record().quest_id().find(...)`. + pub struct QuestRecordQuestIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> QuestRecordTableHandle<'ctx> { + /// Get a handle on the `quest_id` unique index on the table `quest_record`. + pub fn quest_id(&self) -> QuestRecordQuestIdUnique<'ctx> { + QuestRecordQuestIdUnique { + imp: self.imp.get_unique_constraint::("quest_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> QuestRecordQuestIdUnique<'ctx> { + /// Find the subscribed row whose `quest_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("quest_record"); + _table.add_unique_constraint::("quest_id", |row| &row.quest_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `QuestRecord`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait quest_recordQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `QuestRecord`. + fn quest_record(&self) -> __sdk::__query_builder::Table; + } + + impl quest_recordQueryTableAccess for __sdk::QueryTableAccessor { + fn quest_record(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("quest_record") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs new file mode 100644 index 00000000..6c92ecfb --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs @@ -0,0 +1,163 @@ +// 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::refresh_session_type::RefreshSession; + +/// Table handle for the table `refresh_session`. +/// +/// Obtain a handle from the [`RefreshSessionTableAccess::refresh_session`] method on [`super::RemoteTables`], +/// like `ctx.db.refresh_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.refresh_session().on_insert(...)`. +pub struct RefreshSessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `refresh_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait RefreshSessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`RefreshSessionTableHandle`], which mediates access to the table `refresh_session`. + fn refresh_session(&self) -> RefreshSessionTableHandle<'_>; +} + +impl RefreshSessionTableAccess for super::RemoteTables { + fn refresh_session(&self) -> RefreshSessionTableHandle<'_> { + RefreshSessionTableHandle { + imp: self.imp.get_table::("refresh_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct RefreshSessionInsertCallbackId(__sdk::CallbackId); +pub struct RefreshSessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for RefreshSessionTableHandle<'ctx> { + type Row = RefreshSession; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = RefreshSessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RefreshSessionInsertCallbackId { + RefreshSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: RefreshSessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = RefreshSessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RefreshSessionDeleteCallbackId { + RefreshSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: RefreshSessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct RefreshSessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for RefreshSessionTableHandle<'ctx> { + type UpdateCallbackId = RefreshSessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> RefreshSessionUpdateCallbackId { + RefreshSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: RefreshSessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `session_id` unique index on the table `refresh_session`, + /// which allows point queries on the field of the same name + /// via the [`RefreshSessionSessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.refresh_session().session_id().find(...)`. + pub struct RefreshSessionSessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> RefreshSessionTableHandle<'ctx> { + /// Get a handle on the `session_id` unique index on the table `refresh_session`. + pub fn session_id(&self) -> RefreshSessionSessionIdUnique<'ctx> { + RefreshSessionSessionIdUnique { + imp: self.imp.get_unique_constraint::("session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> RefreshSessionSessionIdUnique<'ctx> { + /// Find the subscribed row whose `session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("refresh_session"); + _table.add_unique_constraint::("session_id", |row| &row.session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `RefreshSession`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait refresh_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `RefreshSession`. + fn refresh_session(&self) -> __sdk::__query_builder::Table; + } + + impl refresh_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn refresh_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("refresh_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs new file mode 100644 index 00000000..cc7fac56 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs @@ -0,0 +1,164 @@ +// 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::runtime_setting_type::RuntimeSetting; +use super::runtime_platform_theme_type::RuntimePlatformTheme; + +/// Table handle for the table `runtime_setting`. +/// +/// Obtain a handle from the [`RuntimeSettingTableAccess::runtime_setting`] method on [`super::RemoteTables`], +/// like `ctx.db.runtime_setting()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.runtime_setting().on_insert(...)`. +pub struct RuntimeSettingTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `runtime_setting`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait RuntimeSettingTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`RuntimeSettingTableHandle`], which mediates access to the table `runtime_setting`. + fn runtime_setting(&self) -> RuntimeSettingTableHandle<'_>; +} + +impl RuntimeSettingTableAccess for super::RemoteTables { + fn runtime_setting(&self) -> RuntimeSettingTableHandle<'_> { + RuntimeSettingTableHandle { + imp: self.imp.get_table::("runtime_setting"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct RuntimeSettingInsertCallbackId(__sdk::CallbackId); +pub struct RuntimeSettingDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for RuntimeSettingTableHandle<'ctx> { + type Row = RuntimeSetting; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = RuntimeSettingInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RuntimeSettingInsertCallbackId { + RuntimeSettingInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: RuntimeSettingInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = RuntimeSettingDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RuntimeSettingDeleteCallbackId { + RuntimeSettingDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: RuntimeSettingDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct RuntimeSettingUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for RuntimeSettingTableHandle<'ctx> { + type UpdateCallbackId = RuntimeSettingUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> RuntimeSettingUpdateCallbackId { + RuntimeSettingUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: RuntimeSettingUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `user_id` unique index on the table `runtime_setting`, + /// which allows point queries on the field of the same name + /// via the [`RuntimeSettingUserIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.runtime_setting().user_id().find(...)`. + pub struct RuntimeSettingUserIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> RuntimeSettingTableHandle<'ctx> { + /// Get a handle on the `user_id` unique index on the table `runtime_setting`. + pub fn user_id(&self) -> RuntimeSettingUserIdUnique<'ctx> { + RuntimeSettingUserIdUnique { + imp: self.imp.get_unique_constraint::("user_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> RuntimeSettingUserIdUnique<'ctx> { + /// Find the subscribed row whose `user_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("runtime_setting"); + _table.add_unique_constraint::("user_id", |row| &row.user_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `RuntimeSetting`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait runtime_settingQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `RuntimeSetting`. + fn runtime_setting(&self) -> __sdk::__query_builder::Table; + } + + impl runtime_settingQueryTableAccess for __sdk::QueryTableAccessor { + fn runtime_setting(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("runtime_setting") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs new file mode 100644 index 00000000..ea6106d1 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs @@ -0,0 +1,163 @@ +// 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::runtime_snapshot_row_type::RuntimeSnapshotRow; + +/// Table handle for the table `runtime_snapshot`. +/// +/// Obtain a handle from the [`RuntimeSnapshotTableAccess::runtime_snapshot`] method on [`super::RemoteTables`], +/// like `ctx.db.runtime_snapshot()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.runtime_snapshot().on_insert(...)`. +pub struct RuntimeSnapshotTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `runtime_snapshot`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait RuntimeSnapshotTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`RuntimeSnapshotTableHandle`], which mediates access to the table `runtime_snapshot`. + fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_>; +} + +impl RuntimeSnapshotTableAccess for super::RemoteTables { + fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_> { + RuntimeSnapshotTableHandle { + imp: self.imp.get_table::("runtime_snapshot"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct RuntimeSnapshotInsertCallbackId(__sdk::CallbackId); +pub struct RuntimeSnapshotDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for RuntimeSnapshotTableHandle<'ctx> { + type Row = RuntimeSnapshotRow; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = RuntimeSnapshotInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RuntimeSnapshotInsertCallbackId { + RuntimeSnapshotInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: RuntimeSnapshotInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = RuntimeSnapshotDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> RuntimeSnapshotDeleteCallbackId { + RuntimeSnapshotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: RuntimeSnapshotDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct RuntimeSnapshotUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for RuntimeSnapshotTableHandle<'ctx> { + type UpdateCallbackId = RuntimeSnapshotUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> RuntimeSnapshotUpdateCallbackId { + RuntimeSnapshotUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: RuntimeSnapshotUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `user_id` unique index on the table `runtime_snapshot`, + /// which allows point queries on the field of the same name + /// via the [`RuntimeSnapshotUserIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.runtime_snapshot().user_id().find(...)`. + pub struct RuntimeSnapshotUserIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> RuntimeSnapshotTableHandle<'ctx> { + /// Get a handle on the `user_id` unique index on the table `runtime_snapshot`. + pub fn user_id(&self) -> RuntimeSnapshotUserIdUnique<'ctx> { + RuntimeSnapshotUserIdUnique { + imp: self.imp.get_unique_constraint::("user_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> RuntimeSnapshotUserIdUnique<'ctx> { + /// Find the subscribed row whose `user_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("runtime_snapshot"); + _table.add_unique_constraint::("user_id", |row| &row.user_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `RuntimeSnapshotRow`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait runtime_snapshotQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `RuntimeSnapshotRow`. + fn runtime_snapshot(&self) -> __sdk::__query_builder::Table; + } + + impl runtime_snapshotQueryTableAccess for __sdk::QueryTableAccessor { + fn runtime_snapshot(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("runtime_snapshot") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs new file mode 100644 index 00000000..b702797b --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs @@ -0,0 +1,164 @@ +// 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::story_event_type::StoryEvent; +use super::story_event_kind_type::StoryEventKind; + +/// Table handle for the table `story_event`. +/// +/// Obtain a handle from the [`StoryEventTableAccess::story_event`] method on [`super::RemoteTables`], +/// like `ctx.db.story_event()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.story_event().on_insert(...)`. +pub struct StoryEventTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `story_event`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait StoryEventTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`StoryEventTableHandle`], which mediates access to the table `story_event`. + fn story_event(&self) -> StoryEventTableHandle<'_>; +} + +impl StoryEventTableAccess for super::RemoteTables { + fn story_event(&self) -> StoryEventTableHandle<'_> { + StoryEventTableHandle { + imp: self.imp.get_table::("story_event"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct StoryEventInsertCallbackId(__sdk::CallbackId); +pub struct StoryEventDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for StoryEventTableHandle<'ctx> { + type Row = StoryEvent; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = StoryEventInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> StoryEventInsertCallbackId { + StoryEventInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: StoryEventInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = StoryEventDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> StoryEventDeleteCallbackId { + StoryEventDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: StoryEventDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct StoryEventUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for StoryEventTableHandle<'ctx> { + type UpdateCallbackId = StoryEventUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> StoryEventUpdateCallbackId { + StoryEventUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: StoryEventUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `event_id` unique index on the table `story_event`, + /// which allows point queries on the field of the same name + /// via the [`StoryEventEventIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.story_event().event_id().find(...)`. + pub struct StoryEventEventIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> StoryEventTableHandle<'ctx> { + /// Get a handle on the `event_id` unique index on the table `story_event`. + pub fn event_id(&self) -> StoryEventEventIdUnique<'ctx> { + StoryEventEventIdUnique { + imp: self.imp.get_unique_constraint::("event_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> StoryEventEventIdUnique<'ctx> { + /// Find the subscribed row whose `event_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("story_event"); + _table.add_unique_constraint::("event_id", |row| &row.event_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `StoryEvent`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait story_eventQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `StoryEvent`. + fn story_event(&self) -> __sdk::__query_builder::Table; + } + + impl story_eventQueryTableAccess for __sdk::QueryTableAccessor { + fn story_event(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("story_event") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs new file mode 100644 index 00000000..d3b4dd67 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs @@ -0,0 +1,164 @@ +// 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::story_session_type::StorySession; +use super::story_session_status_type::StorySessionStatus; + +/// Table handle for the table `story_session`. +/// +/// Obtain a handle from the [`StorySessionTableAccess::story_session`] method on [`super::RemoteTables`], +/// like `ctx.db.story_session()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.story_session().on_insert(...)`. +pub struct StorySessionTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `story_session`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait StorySessionTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`StorySessionTableHandle`], which mediates access to the table `story_session`. + fn story_session(&self) -> StorySessionTableHandle<'_>; +} + +impl StorySessionTableAccess for super::RemoteTables { + fn story_session(&self) -> StorySessionTableHandle<'_> { + StorySessionTableHandle { + imp: self.imp.get_table::("story_session"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct StorySessionInsertCallbackId(__sdk::CallbackId); +pub struct StorySessionDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for StorySessionTableHandle<'ctx> { + type Row = StorySession; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = StorySessionInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> StorySessionInsertCallbackId { + StorySessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: StorySessionInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = StorySessionDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> StorySessionDeleteCallbackId { + StorySessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: StorySessionDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct StorySessionUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for StorySessionTableHandle<'ctx> { + type UpdateCallbackId = StorySessionUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> StorySessionUpdateCallbackId { + StorySessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: StorySessionUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `story_session_id` unique index on the table `story_session`, + /// which allows point queries on the field of the same name + /// via the [`StorySessionStorySessionIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.story_session().story_session_id().find(...)`. + pub struct StorySessionStorySessionIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> StorySessionTableHandle<'ctx> { + /// Get a handle on the `story_session_id` unique index on the table `story_session`. + pub fn story_session_id(&self) -> StorySessionStorySessionIdUnique<'ctx> { + StorySessionStorySessionIdUnique { + imp: self.imp.get_unique_constraint::("story_session_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> StorySessionStorySessionIdUnique<'ctx> { + /// Find the subscribed row whose `story_session_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("story_session"); + _table.add_unique_constraint::("story_session_id", |row| &row.story_session_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `StorySession`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait story_sessionQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `StorySession`. + fn story_session(&self) -> __sdk::__query_builder::Table; + } + + impl story_sessionQueryTableAccess for __sdk::QueryTableAccessor { + fn story_session(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("story_session") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs new file mode 100644 index 00000000..c4e7b6cd --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs @@ -0,0 +1,165 @@ +// 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::treasure_record_type::TreasureRecord; +use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot; +use super::treasure_interaction_action_type::TreasureInteractionAction; + +/// Table handle for the table `treasure_record`. +/// +/// Obtain a handle from the [`TreasureRecordTableAccess::treasure_record`] method on [`super::RemoteTables`], +/// like `ctx.db.treasure_record()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.treasure_record().on_insert(...)`. +pub struct TreasureRecordTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `treasure_record`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait TreasureRecordTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`TreasureRecordTableHandle`], which mediates access to the table `treasure_record`. + fn treasure_record(&self) -> TreasureRecordTableHandle<'_>; +} + +impl TreasureRecordTableAccess for super::RemoteTables { + fn treasure_record(&self) -> TreasureRecordTableHandle<'_> { + TreasureRecordTableHandle { + imp: self.imp.get_table::("treasure_record"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct TreasureRecordInsertCallbackId(__sdk::CallbackId); +pub struct TreasureRecordDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for TreasureRecordTableHandle<'ctx> { + type Row = TreasureRecord; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = TreasureRecordInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> TreasureRecordInsertCallbackId { + TreasureRecordInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: TreasureRecordInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = TreasureRecordDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> TreasureRecordDeleteCallbackId { + TreasureRecordDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: TreasureRecordDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct TreasureRecordUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for TreasureRecordTableHandle<'ctx> { + type UpdateCallbackId = TreasureRecordUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> TreasureRecordUpdateCallbackId { + TreasureRecordUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: TreasureRecordUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `treasure_record_id` unique index on the table `treasure_record`, + /// which allows point queries on the field of the same name + /// via the [`TreasureRecordTreasureRecordIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.treasure_record().treasure_record_id().find(...)`. + pub struct TreasureRecordTreasureRecordIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> TreasureRecordTableHandle<'ctx> { + /// Get a handle on the `treasure_record_id` unique index on the table `treasure_record`. + pub fn treasure_record_id(&self) -> TreasureRecordTreasureRecordIdUnique<'ctx> { + TreasureRecordTreasureRecordIdUnique { + imp: self.imp.get_unique_constraint::("treasure_record_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> TreasureRecordTreasureRecordIdUnique<'ctx> { + /// Find the subscribed row whose `treasure_record_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("treasure_record"); + _table.add_unique_constraint::("treasure_record_id", |row| &row.treasure_record_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `TreasureRecord`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait treasure_recordQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `TreasureRecord`. + fn treasure_record(&self) -> __sdk::__query_builder::Table; + } + + impl treasure_recordQueryTableAccess for __sdk::QueryTableAccessor { + fn treasure_record(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("treasure_record") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs new file mode 100644 index 00000000..082d5303 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs @@ -0,0 +1,163 @@ +// 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::user_account_type::UserAccount; + +/// Table handle for the table `user_account`. +/// +/// Obtain a handle from the [`UserAccountTableAccess::user_account`] method on [`super::RemoteTables`], +/// like `ctx.db.user_account()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.user_account().on_insert(...)`. +pub struct UserAccountTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `user_account`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait UserAccountTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`UserAccountTableHandle`], which mediates access to the table `user_account`. + fn user_account(&self) -> UserAccountTableHandle<'_>; +} + +impl UserAccountTableAccess for super::RemoteTables { + fn user_account(&self) -> UserAccountTableHandle<'_> { + UserAccountTableHandle { + imp: self.imp.get_table::("user_account"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct UserAccountInsertCallbackId(__sdk::CallbackId); +pub struct UserAccountDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for UserAccountTableHandle<'ctx> { + type Row = UserAccount; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = UserAccountInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> UserAccountInsertCallbackId { + UserAccountInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: UserAccountInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = UserAccountDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> UserAccountDeleteCallbackId { + UserAccountDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: UserAccountDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct UserAccountUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for UserAccountTableHandle<'ctx> { + type UpdateCallbackId = UserAccountUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> UserAccountUpdateCallbackId { + UserAccountUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: UserAccountUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `user_id` unique index on the table `user_account`, + /// which allows point queries on the field of the same name + /// via the [`UserAccountUserIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.user_account().user_id().find(...)`. + pub struct UserAccountUserIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> UserAccountTableHandle<'ctx> { + /// Get a handle on the `user_id` unique index on the table `user_account`. + pub fn user_id(&self) -> UserAccountUserIdUnique<'ctx> { + UserAccountUserIdUnique { + imp: self.imp.get_unique_constraint::("user_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> UserAccountUserIdUnique<'ctx> { + /// Find the subscribed row whose `user_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("user_account"); + _table.add_unique_constraint::("user_id", |row| &row.user_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `UserAccount`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait user_accountQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `UserAccount`. + fn user_account(&self) -> __sdk::__query_builder::Table; + } + + impl user_accountQueryTableAccess for __sdk::QueryTableAccessor { + fn user_account(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("user_account") + } + } + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs new file mode 100644 index 00000000..933556ca --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs @@ -0,0 +1,164 @@ +// 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::user_browse_history_type::UserBrowseHistory; +use super::runtime_browse_history_theme_mode_type::RuntimeBrowseHistoryThemeMode; + +/// Table handle for the table `user_browse_history`. +/// +/// Obtain a handle from the [`UserBrowseHistoryTableAccess::user_browse_history`] method on [`super::RemoteTables`], +/// like `ctx.db.user_browse_history()`. +/// +/// Users are encouraged not to explicitly reference this type, +/// but to directly chain method calls, +/// like `ctx.db.user_browse_history().on_insert(...)`. +pub struct UserBrowseHistoryTableHandle<'ctx> { + imp: __sdk::TableHandle, + ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the table `user_browse_history`. +/// +/// Implemented for [`super::RemoteTables`]. +pub trait UserBrowseHistoryTableAccess { + #[allow(non_snake_case)] + /// Obtain a [`UserBrowseHistoryTableHandle`], which mediates access to the table `user_browse_history`. + fn user_browse_history(&self) -> UserBrowseHistoryTableHandle<'_>; +} + +impl UserBrowseHistoryTableAccess for super::RemoteTables { + fn user_browse_history(&self) -> UserBrowseHistoryTableHandle<'_> { + UserBrowseHistoryTableHandle { + imp: self.imp.get_table::("user_browse_history"), + ctx: std::marker::PhantomData, + } + } +} + +pub struct UserBrowseHistoryInsertCallbackId(__sdk::CallbackId); +pub struct UserBrowseHistoryDeleteCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::Table for UserBrowseHistoryTableHandle<'ctx> { + type Row = UserBrowseHistory; + type EventContext = super::EventContext; + + fn count(&self) -> u64 { self.imp.count() } + fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } + + type InsertCallbackId = UserBrowseHistoryInsertCallbackId; + + fn on_insert( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> UserBrowseHistoryInsertCallbackId { + UserBrowseHistoryInsertCallbackId(self.imp.on_insert(Box::new(callback))) + } + + fn remove_on_insert(&self, callback: UserBrowseHistoryInsertCallbackId) { + self.imp.remove_on_insert(callback.0) + } + + type DeleteCallbackId = UserBrowseHistoryDeleteCallbackId; + + fn on_delete( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, + ) -> UserBrowseHistoryDeleteCallbackId { + UserBrowseHistoryDeleteCallbackId(self.imp.on_delete(Box::new(callback))) + } + + fn remove_on_delete(&self, callback: UserBrowseHistoryDeleteCallbackId) { + self.imp.remove_on_delete(callback.0) + } +} + +pub struct UserBrowseHistoryUpdateCallbackId(__sdk::CallbackId); + +impl<'ctx> __sdk::TableWithPrimaryKey for UserBrowseHistoryTableHandle<'ctx> { + type UpdateCallbackId = UserBrowseHistoryUpdateCallbackId; + + fn on_update( + &self, + callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, + ) -> UserBrowseHistoryUpdateCallbackId { + UserBrowseHistoryUpdateCallbackId(self.imp.on_update(Box::new(callback))) + } + + fn remove_on_update(&self, callback: UserBrowseHistoryUpdateCallbackId) { + self.imp.remove_on_update(callback.0) + } +} + + /// Access to the `browse_history_id` unique index on the table `user_browse_history`, + /// which allows point queries on the field of the same name + /// via the [`UserBrowseHistoryBrowseHistoryIdUnique::find`] method. + /// + /// Users are encouraged not to explicitly reference this type, + /// but to directly chain method calls, + /// like `ctx.db.user_browse_history().browse_history_id().find(...)`. + pub struct UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { + imp: __sdk::UniqueConstraintHandle, + phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, + } + + impl<'ctx> UserBrowseHistoryTableHandle<'ctx> { + /// Get a handle on the `browse_history_id` unique index on the table `user_browse_history`. + pub fn browse_history_id(&self) -> UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { + UserBrowseHistoryBrowseHistoryIdUnique { + imp: self.imp.get_unique_constraint::("browse_history_id"), + phantom: std::marker::PhantomData, + } + } + } + + impl<'ctx> UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { + /// Find the subscribed row whose `browse_history_id` column value is equal to `col_val`, + /// if such a row is present in the client cache. + pub fn find(&self, col_val: &String) -> Option { + self.imp.find(col_val) + } + } + +#[doc(hidden)] +pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { + + let _table = client_cache.get_or_make_table::("user_browse_history"); + _table.add_unique_constraint::("browse_history_id", |row| &row.browse_history_id); +} + +#[doc(hidden)] +pub(super) fn parse_table_update( + raw_updates: __ws::v2::TableUpdate, +) -> __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 `UserBrowseHistory`. + /// + /// Implemented for [`__sdk::QueryTableAccessor`]. + pub trait user_browse_historyQueryTableAccess { + #[allow(non_snake_case)] + /// Get a query builder for the table `UserBrowseHistory`. + fn user_browse_history(&self) -> __sdk::__query_builder::Table; + } + + impl user_browse_historyQueryTableAccess for __sdk::QueryTableAccessor { + fn user_browse_history(&self) -> __sdk::__query_builder::Table { + __sdk::__query_builder::Table::new("user_browse_history") + } + } +