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