2026-02-07 22:45:43 -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-22 00:08:02 -08:00
|
|
|
use super::game_state_type::GameState;
|
2026-02-07 22:45:43 -08:00
|
|
|
use super::lobby_type::Lobby;
|
2026-02-08 23:47:57 -08:00
|
|
|
use super::player_or_bot_type::PlayerOrBot;
|
2026-02-22 00:08:02 -08:00
|
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
2026-02-07 22:45:43 -08:00
|
|
|
|
|
|
|
|
/// Table handle for the table `lobby`.
|
|
|
|
|
///
|
|
|
|
|
/// Obtain a handle from the [`LobbyTableAccess::lobby`] method on [`super::RemoteTables`],
|
|
|
|
|
/// like `ctx.db.lobby()`.
|
|
|
|
|
///
|
|
|
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
|
|
|
/// but to directly chain method calls,
|
|
|
|
|
/// like `ctx.db.lobby().on_insert(...)`.
|
|
|
|
|
pub struct LobbyTableHandle<'ctx> {
|
|
|
|
|
imp: __sdk::TableHandle<Lobby>,
|
|
|
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
/// Extension trait for access to the table `lobby`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::RemoteTables`].
|
|
|
|
|
pub trait LobbyTableAccess {
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
/// Obtain a [`LobbyTableHandle`], which mediates access to the table `lobby`.
|
|
|
|
|
fn lobby(&self) -> LobbyTableHandle<'_>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl LobbyTableAccess for super::RemoteTables {
|
|
|
|
|
fn lobby(&self) -> LobbyTableHandle<'_> {
|
|
|
|
|
LobbyTableHandle {
|
|
|
|
|
imp: self.imp.get_table::<Lobby>("lobby"),
|
|
|
|
|
ctx: std::marker::PhantomData,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct LobbyInsertCallbackId(__sdk::CallbackId);
|
|
|
|
|
pub struct LobbyDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> {
|
|
|
|
|
type Row = Lobby;
|
|
|
|
|
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 = Lobby> + '_ {
|
|
|
|
|
self.imp.iter()
|
|
|
|
|
}
|
2026-02-07 22:45:43 -08:00
|
|
|
|
|
|
|
|
type InsertCallbackId = LobbyInsertCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_insert(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> LobbyInsertCallbackId {
|
|
|
|
|
LobbyInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_insert(&self, callback: LobbyInsertCallbackId) {
|
|
|
|
|
self.imp.remove_on_insert(callback.0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DeleteCallbackId = LobbyDeleteCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_delete(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> LobbyDeleteCallbackId {
|
|
|
|
|
LobbyDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_delete(&self, callback: LobbyDeleteCallbackId) {
|
|
|
|
|
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::<Lobby>("lobby");
|
2026-02-07 22:45:43 -08:00
|
|
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
|
|
|
|
}
|
|
|
|
|
pub struct LobbyUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for LobbyTableHandle<'ctx> {
|
|
|
|
|
type UpdateCallbackId = LobbyUpdateCallbackId;
|
|
|
|
|
|
|
|
|
|
fn on_update(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
|
|
|
) -> LobbyUpdateCallbackId {
|
|
|
|
|
LobbyUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn remove_on_update(&self, callback: LobbyUpdateCallbackId) {
|
|
|
|
|
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<Lobby>> {
|
|
|
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
2026-02-22 00:08:02 -08:00
|
|
|
__sdk::InternalError::failed_parse("TableUpdate<Lobby>", "TableUpdate")
|
|
|
|
|
.with_cause(e)
|
|
|
|
|
.into()
|
2026-02-07 22:45:43 -08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
/// Access to the `id` unique index on the table `lobby`,
|
|
|
|
|
/// which allows point queries on the field of the same name
|
|
|
|
|
/// via the [`LobbyIdUnique::find`] method.
|
|
|
|
|
///
|
|
|
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
|
|
|
/// but to directly chain method calls,
|
|
|
|
|
/// like `ctx.db.lobby().id().find(...)`.
|
|
|
|
|
pub struct LobbyIdUnique<'ctx> {
|
|
|
|
|
imp: __sdk::UniqueConstraintHandle<Lobby, u32>,
|
|
|
|
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
|
|
|
}
|
2026-02-07 22:45:43 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
impl<'ctx> LobbyTableHandle<'ctx> {
|
|
|
|
|
/// Get a handle on the `id` unique index on the table `lobby`.
|
|
|
|
|
pub fn id(&self) -> LobbyIdUnique<'ctx> {
|
|
|
|
|
LobbyIdUnique {
|
|
|
|
|
imp: self.imp.get_unique_constraint::<u32>("id"),
|
|
|
|
|
phantom: std::marker::PhantomData,
|
2026-02-08 00:10:10 -08:00
|
|
|
}
|
2026-02-22 00:08:02 -08:00
|
|
|
}
|
|
|
|
|
}
|
2026-02-08 00:10:10 -08:00
|
|
|
|
2026-02-22 00:08:02 -08:00
|
|
|
impl<'ctx> LobbyIdUnique<'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<Lobby> {
|
|
|
|
|
self.imp.find(col_val)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-22 00:39:51 -08:00
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
/// Extension trait for query builder access to the table `Lobby`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`__sdk::QueryTableAccessor`].
|
|
|
|
|
pub trait lobbyQueryTableAccess {
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
/// Get a query builder for the table `Lobby`.
|
|
|
|
|
fn lobby(&self) -> __sdk::__query_builder::Table<Lobby>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl lobbyQueryTableAccess for __sdk::QueryTableAccessor {
|
|
|
|
|
fn lobby(&self) -> __sdk::__query_builder::Table<Lobby> {
|
|
|
|
|
__sdk::__query_builder::Table::new("lobby")
|
|
|
|
|
}
|
|
|
|
|
}
|