codegen
This commit is contained in:
parent
d1446309c4
commit
d7b4221727
41 changed files with 893 additions and 1673 deletions
|
|
@ -2,15 +2,10 @@
|
|||
// 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_state_type::GameState;
|
||||
use super::lobby_type::Lobby;
|
||||
use super::player_or_bot_type::PlayerOrBot;
|
||||
use super::game_state_type::GameState;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `lobby`.
|
||||
///
|
||||
|
|
@ -51,8 +46,12 @@ impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> {
|
|||
type Row = Lobby;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 { self.imp.count() }
|
||||
fn iter(&self) -> impl Iterator<Item = Lobby> + '_ { self.imp.iter() }
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Lobby> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = LobbyInsertCallbackId;
|
||||
|
||||
|
|
@ -83,8 +82,7 @@ impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> {
|
|||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
|
||||
let _table = client_cache.get_or_make_table::<Lobby>("lobby");
|
||||
let _table = client_cache.get_or_make_table::<Lobby>("lobby");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
pub struct LobbyUpdateCallbackId(__sdk::CallbackId);
|
||||
|
|
@ -104,46 +102,43 @@ impl<'ctx> __sdk::TableWithPrimaryKey for LobbyTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[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| {
|
||||
__sdk::InternalError::failed_parse(
|
||||
"TableUpdate<Lobby>",
|
||||
"TableUpdate",
|
||||
).with_cause(e).into()
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Lobby>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// 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>,
|
||||
}
|
||||
/// 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>,
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue