2026-02-07 17:46:03 -08:00
|
|
|
// 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)]
|
2026-02-20 15:36:04 -08:00
|
|
|
use spacetimedb_sdk::__codegen::{
|
|
|
|
|
self as __sdk,
|
|
|
|
|
__lib,
|
|
|
|
|
__sats,
|
|
|
|
|
__ws,
|
|
|
|
|
};
|
2026-02-12 17:06:28 -08:00
|
|
|
use super::db_wall_type::DbWall;
|
2026-02-20 15:36:04 -08:00
|
|
|
use super::db_tile_type::DbTile;
|
2026-02-07 17:46:03 -08:00
|
|
|
|
|
|
|
|
/// Table handle for the table `wall`.
|
|
|
|
|
///
|
|
|
|
|
/// Obtain a handle from the [`WallTableAccess::wall`] method on [`super::RemoteTables`],
|
|
|
|
|
/// like `ctx.db.wall()`.
|
|
|
|
|
///
|
|
|
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
|
|
|
/// but to directly chain method calls,
|
|
|
|
|
/// like `ctx.db.wall().on_insert(...)`.
|
|
|
|
|
pub struct WallTableHandle<'ctx> {
|
2026-02-12 17:06:28 -08:00
|
|
|
imp: __sdk::TableHandle<DbWall>,
|
2026-02-07 17:46:03 -08:00
|
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
/// Extension trait for access to the table `wall`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::RemoteTables`].
|
|
|
|
|
pub trait WallTableAccess {
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
/// Obtain a [`WallTableHandle`], which mediates access to the table `wall`.
|
|
|
|
|
fn wall(&self) -> WallTableHandle<'_>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl WallTableAccess for super::RemoteTables {
|
|
|
|
|
fn wall(&self) -> WallTableHandle<'_> {
|
|
|
|
|
WallTableHandle {
|
2026-02-12 17:06:28 -08:00
|
|
|
imp: self.imp.get_table::<DbWall>("wall"),
|
2026-02-07 17:46:03 -08:00
|
|
|
ctx: std::marker::PhantomData,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct WallInsertCallbackId(__sdk::CallbackId);
|
|
|
|
|
pub struct WallDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::Table for WallTableHandle<'ctx> {
|
2026-02-12 17:06:28 -08:00
|
|
|
type Row = DbWall;
|
2026-02-07 17:46:03 -08:00
|
|
|
type EventContext = super::EventContext;
|
|
|
|
|
|
2026-02-20 15:36:04 -08:00
|
|
|
fn count(&self) -> u64 { self.imp.count() }
|
|
|
|
|
fn iter(&self) -> impl Iterator<Item = DbWall> + '_ { self.imp.iter() }
|
2026-02-07 17:46:03 -08:00
|
|
|
|
|
|
|
|
type InsertCallbackId = WallInsertCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_insert(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> WallInsertCallbackId {
|
|
|
|
|
WallInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_insert(&self, callback: WallInsertCallbackId) {
|
|
|
|
|
self.imp.remove_on_insert(callback.0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DeleteCallbackId = WallDeleteCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_delete(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> WallDeleteCallbackId {
|
|
|
|
|
WallDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_delete(&self, callback: WallDeleteCallbackId) {
|
|
|
|
|
self.imp.remove_on_delete(callback.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
2026-02-20 15:36:04 -08:00
|
|
|
|
|
|
|
|
let _table = client_cache.get_or_make_table::<DbWall>("wall");
|
2026-02-08 00:10:10 -08:00
|
|
|
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
2026-02-07 22:45:43 -08:00
|
|
|
}
|
|
|
|
|
pub struct WallUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for WallTableHandle<'ctx> {
|
|
|
|
|
type UpdateCallbackId = WallUpdateCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_update(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> WallUpdateCallbackId {
|
|
|
|
|
WallUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_update(&self, callback: WallUpdateCallbackId) {
|
|
|
|
|
self.imp.remove_on_update(callback.0)
|
|
|
|
|
}
|
2026-02-07 17:46:03 -08:00
|
|
|
}
|
|
|
|
|
|
2026-02-20 15:36:04 -08:00
|
|
|
|
2026-02-07 17:46:03 -08:00
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub(super) fn parse_table_update(
|
|
|
|
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
2026-02-12 17:06:28 -08:00
|
|
|
) -> __sdk::Result<__sdk::TableUpdate<DbWall>> {
|
2026-02-07 17:46:03 -08:00
|
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
2026-02-20 15:36:04 -08:00
|
|
|
__sdk::InternalError::failed_parse(
|
|
|
|
|
"TableUpdate<DbWall>",
|
|
|
|
|
"TableUpdate",
|
|
|
|
|
).with_cause(e).into()
|
2026-02-07 17:46:03 -08:00
|
|
|
})
|
|
|
|
|
}
|
2026-02-07 22:45:43 -08:00
|
|
|
|
2026-02-20 15:36:04 -08:00
|
|
|
/// Access to the `lobby_id` unique index on the table `wall`,
|
|
|
|
|
/// which allows point queries on the field of the same name
|
|
|
|
|
/// via the [`WallLobbyIdUnique::find`] method.
|
|
|
|
|
///
|
|
|
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
|
|
|
/// but to directly chain method calls,
|
|
|
|
|
/// like `ctx.db.wall().lobby_id().find(...)`.
|
|
|
|
|
pub struct WallLobbyIdUnique<'ctx> {
|
|
|
|
|
imp: __sdk::UniqueConstraintHandle<DbWall, u32>,
|
|
|
|
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
|
|
|
}
|
2026-02-08 00:10:10 -08:00
|
|
|
|
2026-02-20 15:36:04 -08:00
|
|
|
impl<'ctx> WallTableHandle<'ctx> {
|
|
|
|
|
/// Get a handle on the `lobby_id` unique index on the table `wall`.
|
|
|
|
|
pub fn lobby_id(&self) -> WallLobbyIdUnique<'ctx> {
|
|
|
|
|
WallLobbyIdUnique {
|
|
|
|
|
imp: self.imp.get_unique_constraint::<u32>("lobby_id"),
|
|
|
|
|
phantom: std::marker::PhantomData,
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-08 00:10:10 -08:00
|
|
|
}
|
|
|
|
|
|
2026-02-20 15:36:04 -08:00
|
|
|
impl<'ctx> WallLobbyIdUnique<'ctx> {
|
|
|
|
|
/// Find the subscribed row whose `lobby_id` column value is equal to `col_val`,
|
|
|
|
|
/// if such a row is present in the client cache.
|
|
|
|
|
pub fn find(&self, col_val: &u32) -> Option<DbWall> {
|
|
|
|
|
self.imp.find(col_val)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|