2026-02-20 15:36:04 -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)]
|
|
|
|
|
use super::player_clock_type::PlayerClock;
|
2026-02-22 00:08:02 -08:00
|
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
2026-02-20 15:36:04 -08:00
|
|
|
|
|
|
|
|
/// Table handle for the table `player_clock`.
|
|
|
|
|
///
|
|
|
|
|
/// Obtain a handle from the [`PlayerClockTableAccess::player_clock`] method on [`super::RemoteTables`],
|
|
|
|
|
/// like `ctx.db.player_clock()`.
|
|
|
|
|
///
|
|
|
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
|
|
|
/// but to directly chain method calls,
|
|
|
|
|
/// like `ctx.db.player_clock().on_insert(...)`.
|
|
|
|
|
pub struct PlayerClockTableHandle<'ctx> {
|
|
|
|
|
imp: __sdk::TableHandle<PlayerClock>,
|
|
|
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
/// Extension trait for access to the table `player_clock`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::RemoteTables`].
|
|
|
|
|
pub trait PlayerClockTableAccess {
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
/// Obtain a [`PlayerClockTableHandle`], which mediates access to the table `player_clock`.
|
|
|
|
|
fn player_clock(&self) -> PlayerClockTableHandle<'_>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl PlayerClockTableAccess for super::RemoteTables {
|
|
|
|
|
fn player_clock(&self) -> PlayerClockTableHandle<'_> {
|
|
|
|
|
PlayerClockTableHandle {
|
|
|
|
|
imp: self.imp.get_table::<PlayerClock>("player_clock"),
|
|
|
|
|
ctx: std::marker::PhantomData,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct PlayerClockInsertCallbackId(__sdk::CallbackId);
|
|
|
|
|
pub struct PlayerClockDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::Table for PlayerClockTableHandle<'ctx> {
|
|
|
|
|
type Row = PlayerClock;
|
|
|
|
|
type EventContext = super::EventContext;
|
|
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
fn count(&self) -> u64 {
|
|
|
|
|
self.imp.count()
|
|
|
|
|
}
|
|
|
|
|
fn iter(&self) -> impl Iterator<Item = PlayerClock> + '_ {
|
|
|
|
|
self.imp.iter()
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
|
|
|
|
|
type InsertCallbackId = PlayerClockInsertCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_insert(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> PlayerClockInsertCallbackId {
|
|
|
|
|
PlayerClockInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_insert(&self, callback: PlayerClockInsertCallbackId) {
|
|
|
|
|
self.imp.remove_on_insert(callback.0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DeleteCallbackId = PlayerClockDeleteCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_delete(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> PlayerClockDeleteCallbackId {
|
|
|
|
|
PlayerClockDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_delete(&self, callback: PlayerClockDeleteCallbackId) {
|
|
|
|
|
self.imp.remove_on_delete(callback.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
2026-02-22 00:08:02 -08:00
|
|
|
let _table = client_cache.get_or_make_table::<PlayerClock>("player_clock");
|
2026-02-20 15:36:04 -08:00
|
|
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
|
|
|
|
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
|
|
|
|
}
|
|
|
|
|
pub struct PlayerClockUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerClockTableHandle<'ctx> {
|
|
|
|
|
type UpdateCallbackId = PlayerClockUpdateCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_update(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> PlayerClockUpdateCallbackId {
|
|
|
|
|
PlayerClockUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_update(&self, callback: PlayerClockUpdateCallbackId) {
|
|
|
|
|
self.imp.remove_on_update(callback.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[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| {
|
2026-02-22 00:08:02 -08:00
|
|
|
__sdk::InternalError::failed_parse("TableUpdate<PlayerClock>", "TableUpdate")
|
|
|
|
|
.with_cause(e)
|
|
|
|
|
.into()
|
2026-02-20 15:36:04 -08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
/// 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>,
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
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,
|
2026-02-20 15:36:04 -08:00
|
|
|
}
|
2026-02-22 00:08:02 -08:00
|
|
|
}
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
/// 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>,
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
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,
|
2026-02-20 15:36:04 -08:00
|
|
|
}
|
2026-02-22 00:08:02 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|