This commit is contained in:
Tao Tien 2026-02-22 00:08:02 -08:00
parent d1446309c4
commit d7b4221727
41 changed files with 893 additions and 1673 deletions

View file

@ -2,13 +2,8 @@
// 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::game_timer_type::GameTimer;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `game_timer`.
///
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> {
type Row = GameTimer;
type EventContext = super::EventContext;
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = GameTimer> + '_ { self.imp.iter() }
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = GameTimer> + '_ {
self.imp.iter()
}
type InsertCallbackId = GameTimerInsertCallbackId;
@ -81,8 +80,7 @@ impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> {
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<GameTimer>("game_timer");
let _table = client_cache.get_or_make_table::<GameTimer>("game_timer");
_table.add_unique_constraint::<u64>("id", |row| &row.id);
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
}
@ -103,76 +101,73 @@ impl<'ctx> __sdk::TableWithPrimaryKey for GameTimerTableHandle<'ctx> {
}
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
) -> __sdk::Result<__sdk::TableUpdate<GameTimer>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse(
"TableUpdate<GameTimer>",
"TableUpdate",
).with_cause(e).into()
__sdk::InternalError::failed_parse("TableUpdate<GameTimer>", "TableUpdate")
.with_cause(e)
.into()
})
}
/// Access to the `id` unique index on the table `game_timer`,
/// which allows point queries on the field of the same name
/// via the [`GameTimerIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.game_timer().id().find(...)`.
pub struct GameTimerIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<GameTimer, u64>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
/// Access to the `id` unique index on the table `game_timer`,
/// which allows point queries on the field of the same name
/// via the [`GameTimerIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.game_timer().id().find(...)`.
pub struct GameTimerIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<GameTimer, u64>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> GameTimerTableHandle<'ctx> {
/// Get a handle on the `id` unique index on the table `game_timer`.
pub fn id(&self) -> GameTimerIdUnique<'ctx> {
GameTimerIdUnique {
imp: self.imp.get_unique_constraint::<u64>("id"),
phantom: std::marker::PhantomData,
}
}
impl<'ctx> GameTimerTableHandle<'ctx> {
/// Get a handle on the `id` unique index on the table `game_timer`.
pub fn id(&self) -> GameTimerIdUnique<'ctx> {
GameTimerIdUnique {
imp: self.imp.get_unique_constraint::<u64>("id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> GameTimerIdUnique<'ctx> {
/// Find the subscribed row whose `id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &u64) -> Option<GameTimer> {
self.imp.find(col_val)
}
}
/// Access to the `lobby_id` unique index on the table `game_timer`,
/// which allows point queries on the field of the same name
/// via the [`GameTimerLobbyIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.game_timer().lobby_id().find(...)`.
pub struct GameTimerLobbyIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<GameTimer, u32>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> GameTimerIdUnique<'ctx> {
/// Find the subscribed row whose `id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &u64) -> Option<GameTimer> {
self.imp.find(col_val)
}
}
impl<'ctx> GameTimerTableHandle<'ctx> {
/// Get a handle on the `lobby_id` unique index on the table `game_timer`.
pub fn lobby_id(&self) -> GameTimerLobbyIdUnique<'ctx> {
GameTimerLobbyIdUnique {
imp: self.imp.get_unique_constraint::<u32>("lobby_id"),
phantom: std::marker::PhantomData,
}
}
}
/// Access to the `lobby_id` unique index on the table `game_timer`,
/// which allows point queries on the field of the same name
/// via the [`GameTimerLobbyIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.game_timer().lobby_id().find(...)`.
pub struct GameTimerLobbyIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<GameTimer, u32>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> GameTimerLobbyIdUnique<'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<GameTimer> {
self.imp.find(col_val)
}
impl<'ctx> GameTimerTableHandle<'ctx> {
/// Get a handle on the `lobby_id` unique index on the table `game_timer`.
pub fn lobby_id(&self) -> GameTimerLobbyIdUnique<'ctx> {
GameTimerLobbyIdUnique {
imp: self.imp.get_unique_constraint::<u32>("lobby_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> GameTimerLobbyIdUnique<'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<GameTimer> {
self.imp.find(col_val)
}
}