upgrade spacetimedb to v2.0.1
This commit is contained in:
parent
5ebf3f6c05
commit
baab16144b
38 changed files with 481 additions and 1647 deletions
|
|
@ -22,8 +22,6 @@ impl __sdk::InModule for AddBotArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct AddBotCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `add_bot`.
|
||||
///
|
||||
|
|
@ -33,72 +31,38 @@ pub trait add_bot {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_add_bot`] callbacks.
|
||||
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `add_bot`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`add_bot:add_bot_then`] to run a callback after the reducer completes.
|
||||
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||
self.add_bot_then(lobby_id, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `add_bot` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`AddBotCallbackId`] can be passed to [`Self::remove_on_add_bot`]
|
||||
/// to cancel the callback.
|
||||
fn on_add_bot(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn add_bot_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> AddBotCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_add_bot`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_add_bot(&self, callback: AddBotCallbackId);
|
||||
lobby_id: u32,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl add_bot for super::RemoteReducers {
|
||||
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||
self.imp.call_reducer("add_bot", AddBotArgs { lobby_id })
|
||||
}
|
||||
fn on_add_bot(
|
||||
fn add_bot_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> AddBotCallbackId {
|
||||
AddBotCallbackId(self.imp.on_reducer(
|
||||
"add_bot",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::AddBot { lobby_id },
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx, lobby_id)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_add_bot(&self, callback: AddBotCallbackId) {
|
||||
self.imp.remove_on_reducer("add_bot", callback.0)
|
||||
}
|
||||
}
|
||||
lobby_id: u32,
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `add_bot`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_add_bot {
|
||||
/// Set the call-reducer flags for the reducer `add_bot` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn add_bot(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_add_bot for super::SetReducerFlags {
|
||||
fn add_bot(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("add_bot", flags);
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(AddBotArgs { lobby_id }, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ impl __sdk::InModule for AdvanceGameArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct AdvanceGameCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `advance_game`.
|
||||
///
|
||||
|
|
@ -35,73 +33,38 @@ pub trait advance_game {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_advance_game`] callbacks.
|
||||
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `advance_game`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`advance_game:advance_game_then`] to run a callback after the reducer completes.
|
||||
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()> {
|
||||
self.advance_game_then(game_timer, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `advance_game` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`AdvanceGameCallbackId`] can be passed to [`Self::remove_on_advance_game`]
|
||||
/// to cancel the callback.
|
||||
fn on_advance_game(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn advance_game_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
||||
) -> AdvanceGameCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_advance_game`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId);
|
||||
game_timer: GameTimer,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl advance_game for super::RemoteReducers {
|
||||
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.call_reducer("advance_game", AdvanceGameArgs { game_timer })
|
||||
}
|
||||
fn on_advance_game(
|
||||
fn advance_game_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
||||
) -> AdvanceGameCallbackId {
|
||||
AdvanceGameCallbackId(self.imp.on_reducer(
|
||||
"advance_game",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::AdvanceGame { game_timer },
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx, game_timer)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId) {
|
||||
self.imp.remove_on_reducer("advance_game", callback.0)
|
||||
}
|
||||
}
|
||||
game_timer: GameTimer,
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `advance_game`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_advance_game {
|
||||
/// Set the call-reducer flags for the reducer `advance_game` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn advance_game(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_advance_game for super::SetReducerFlags {
|
||||
fn advance_game(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("advance_game", flags);
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(AdvanceGameArgs { game_timer }, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,11 +80,6 @@ impl<'ctx> __sdk::Table for BotTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<Bot>("bot");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
pub struct BotUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for BotTableHandle<'ctx> {
|
||||
|
|
@ -102,17 +97,6 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BotTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Bot>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Bot>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `bot`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`BotIdUnique::find`] method.
|
||||
|
|
@ -143,6 +127,23 @@ impl<'ctx> BotIdUnique<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<Bot>("bot");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Bot>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Bot>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Bot`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -65,3 +65,5 @@ impl __sdk::__query_builder::HasIxCols for Bot {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Bot {}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ impl __sdk::InModule for ClearAllArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct ClearAllCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `clear_all`.
|
||||
///
|
||||
|
|
@ -29,72 +27,36 @@ pub trait clear_all {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_clear_all`] callbacks.
|
||||
fn clear_all(&self) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `clear_all`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`clear_all:clear_all_then`] to run a callback after the reducer completes.
|
||||
fn clear_all(&self) -> __sdk::Result<()> {
|
||||
self.clear_all_then(|_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `clear_all` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`ClearAllCallbackId`] can be passed to [`Self::remove_on_clear_all`]
|
||||
/// to cancel the callback.
|
||||
fn on_clear_all(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn clear_all_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> ClearAllCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_clear_all`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_clear_all(&self, callback: ClearAllCallbackId);
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl clear_all for super::RemoteReducers {
|
||||
fn clear_all(&self) -> __sdk::Result<()> {
|
||||
self.imp.call_reducer("clear_all", ClearAllArgs {})
|
||||
}
|
||||
fn on_clear_all(
|
||||
fn clear_all_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> ClearAllCallbackId {
|
||||
ClearAllCallbackId(self.imp.on_reducer(
|
||||
"clear_all",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::ClearAll {},
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_clear_all(&self, callback: ClearAllCallbackId) {
|
||||
self.imp.remove_on_reducer("clear_all", callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `clear_all`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_clear_all {
|
||||
/// Set the call-reducer flags for the reducer `clear_all` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn clear_all(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_clear_all for super::SetReducerFlags {
|
||||
fn clear_all(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("clear_all", flags);
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(ClearAllArgs {}, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub(super) struct ConnectArgs {}
|
||||
|
||||
impl From<ConnectArgs> for super::Reducer {
|
||||
fn from(args: ConnectArgs) -> Self {
|
||||
Self::Connect
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ConnectArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct ConnectCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `connect`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait connect {
|
||||
/// Request that the remote module invoke the reducer `connect` to run as soon as possible.
|
||||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_connect`] callbacks.
|
||||
fn connect(&self) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `connect`.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`ConnectCallbackId`] can be passed to [`Self::remove_on_connect`]
|
||||
/// to cancel the callback.
|
||||
fn on_connect(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> ConnectCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_connect`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_connect(&self, callback: ConnectCallbackId);
|
||||
}
|
||||
|
||||
impl connect for super::RemoteReducers {
|
||||
fn connect(&self) -> __sdk::Result<()> {
|
||||
self.imp.call_reducer("connect", ConnectArgs {})
|
||||
}
|
||||
fn on_connect(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> ConnectCallbackId {
|
||||
ConnectCallbackId(self.imp.on_reducer(
|
||||
"connect",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::Connect {},
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_connect(&self, callback: ConnectCallbackId) {
|
||||
self.imp.remove_on_reducer("connect", callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `connect`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_connect {
|
||||
/// Set the call-reducer flags for the reducer `connect` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn connect(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_connect for super::SetReducerFlags {
|
||||
fn connect(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("connect", flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,3 +50,5 @@ impl __sdk::__query_builder::HasIxCols for DbTile {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for DbTile {}
|
||||
|
|
|
|||
|
|
@ -50,3 +50,5 @@ impl __sdk::__query_builder::HasIxCols for DbWall {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for DbWall {}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ impl __sdk::InModule for DiscardTileArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct DiscardTileCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `discard_tile`.
|
||||
///
|
||||
|
|
@ -33,73 +31,38 @@ pub trait discard_tile {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_discard_tile`] callbacks.
|
||||
fn discard_tile(&self, tile_id: u32) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `discard_tile`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`discard_tile:discard_tile_then`] to run a callback after the reducer completes.
|
||||
fn discard_tile(&self, tile_id: u32) -> __sdk::Result<()> {
|
||||
self.discard_tile_then(tile_id, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `discard_tile` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`DiscardTileCallbackId`] can be passed to [`Self::remove_on_discard_tile`]
|
||||
/// to cancel the callback.
|
||||
fn on_discard_tile(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn discard_tile_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> DiscardTileCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_discard_tile`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_discard_tile(&self, callback: DiscardTileCallbackId);
|
||||
tile_id: u32,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl discard_tile for super::RemoteReducers {
|
||||
fn discard_tile(&self, tile_id: u32) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.call_reducer("discard_tile", DiscardTileArgs { tile_id })
|
||||
}
|
||||
fn on_discard_tile(
|
||||
fn discard_tile_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> DiscardTileCallbackId {
|
||||
DiscardTileCallbackId(self.imp.on_reducer(
|
||||
"discard_tile",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::DiscardTile { tile_id },
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx, tile_id)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_discard_tile(&self, callback: DiscardTileCallbackId) {
|
||||
self.imp.remove_on_reducer("discard_tile", callback.0)
|
||||
}
|
||||
}
|
||||
tile_id: u32,
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `discard_tile`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_discard_tile {
|
||||
/// Set the call-reducer flags for the reducer `discard_tile` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn discard_tile(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_discard_tile for super::SetReducerFlags {
|
||||
fn discard_tile(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("discard_tile", flags);
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(DiscardTileArgs { tile_id }, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub(super) struct DisconnectArgs {}
|
||||
|
||||
impl From<DisconnectArgs> for super::Reducer {
|
||||
fn from(args: DisconnectArgs) -> Self {
|
||||
Self::Disconnect
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for DisconnectArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct DisconnectCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `disconnect`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait disconnect {
|
||||
/// Request that the remote module invoke the reducer `disconnect` to run as soon as possible.
|
||||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_disconnect`] callbacks.
|
||||
fn disconnect(&self) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `disconnect`.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`DisconnectCallbackId`] can be passed to [`Self::remove_on_disconnect`]
|
||||
/// to cancel the callback.
|
||||
fn on_disconnect(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> DisconnectCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_disconnect`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_disconnect(&self, callback: DisconnectCallbackId);
|
||||
}
|
||||
|
||||
impl disconnect for super::RemoteReducers {
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.call_reducer("disconnect", DisconnectArgs {})
|
||||
}
|
||||
fn on_disconnect(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||
) -> DisconnectCallbackId {
|
||||
DisconnectCallbackId(self.imp.on_reducer(
|
||||
"disconnect",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::Disconnect {},
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_disconnect(&self, callback: DisconnectCallbackId) {
|
||||
self.imp.remove_on_reducer("disconnect", callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `disconnect`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_disconnect {
|
||||
/// Set the call-reducer flags for the reducer `disconnect` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn disconnect(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_disconnect for super::SetReducerFlags {
|
||||
fn disconnect(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("disconnect", flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,12 +78,6 @@ 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");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||
}
|
||||
pub struct GameTimerUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for GameTimerTableHandle<'ctx> {
|
||||
|
|
@ -101,17 +95,6 @@ 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()
|
||||
})
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
|
@ -172,6 +155,24 @@ impl<'ctx> GameTimerLobbyIdUnique<'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");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __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()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `GameTimer`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -53,3 +53,5 @@ impl __sdk::__query_builder::HasIxCols for GameTimer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for GameTimer {}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ impl __sdk::InModule for JoinOrCreateLobbyArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct JoinOrCreateLobbyCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `join_or_create_lobby`.
|
||||
///
|
||||
|
|
@ -33,75 +31,38 @@ pub trait join_or_create_lobby {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_join_or_create_lobby`] callbacks.
|
||||
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `join_or_create_lobby`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`join_or_create_lobby:join_or_create_lobby_then`] to run a callback after the reducer completes.
|
||||
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||
self.join_or_create_lobby_then(lobby_id, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `join_or_create_lobby` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`JoinOrCreateLobbyCallbackId`] can be passed to [`Self::remove_on_join_or_create_lobby`]
|
||||
/// to cancel the callback.
|
||||
fn on_join_or_create_lobby(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn join_or_create_lobby_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> JoinOrCreateLobbyCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_join_or_create_lobby`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId);
|
||||
lobby_id: u32,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl join_or_create_lobby for super::RemoteReducers {
|
||||
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.call_reducer("join_or_create_lobby", JoinOrCreateLobbyArgs { lobby_id })
|
||||
}
|
||||
fn on_join_or_create_lobby(
|
||||
fn join_or_create_lobby_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||
) -> JoinOrCreateLobbyCallbackId {
|
||||
JoinOrCreateLobbyCallbackId(self.imp.on_reducer(
|
||||
"join_or_create_lobby",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::JoinOrCreateLobby { lobby_id },
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx, lobby_id)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId) {
|
||||
self.imp
|
||||
.remove_on_reducer("join_or_create_lobby", callback.0)
|
||||
}
|
||||
}
|
||||
lobby_id: u32,
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `join_or_create_lobby`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_join_or_create_lobby {
|
||||
/// Set the call-reducer flags for the reducer `join_or_create_lobby` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_join_or_create_lobby for super::SetReducerFlags {
|
||||
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags) {
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.set_call_reducer_flags("join_or_create_lobby", flags);
|
||||
.invoke_reducer_with_callback(JoinOrCreateLobbyArgs { lobby_id }, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,11 +80,6 @@ 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");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
pub struct LobbyUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for LobbyTableHandle<'ctx> {
|
||||
|
|
@ -102,17 +97,6 @@ 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()
|
||||
})
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
|
@ -143,6 +127,23 @@ impl<'ctx> LobbyIdUnique<'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");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __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()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Lobby`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -60,3 +60,5 @@ impl __sdk::__query_builder::HasIxCols for Lobby {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Lobby {}
|
||||
|
|
|
|||
|
|
@ -1,191 +0,0 @@
|
|||
// 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_type::Player;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `logged_out_player`.
|
||||
///
|
||||
/// Obtain a handle from the [`LoggedOutPlayerTableAccess::logged_out_player`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.logged_out_player()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.logged_out_player().on_insert(...)`.
|
||||
pub struct LoggedOutPlayerTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<Player>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `logged_out_player`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait LoggedOutPlayerTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`LoggedOutPlayerTableHandle`], which mediates access to the table `logged_out_player`.
|
||||
fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl LoggedOutPlayerTableAccess for super::RemoteTables {
|
||||
fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_> {
|
||||
LoggedOutPlayerTableHandle {
|
||||
imp: self.imp.get_table::<Player>("logged_out_player"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LoggedOutPlayerInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct LoggedOutPlayerDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> {
|
||||
type Row = Player;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Player> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = LoggedOutPlayerInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> LoggedOutPlayerInsertCallbackId {
|
||||
LoggedOutPlayerInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: LoggedOutPlayerInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = LoggedOutPlayerDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> LoggedOutPlayerDeleteCallbackId {
|
||||
LoggedOutPlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: LoggedOutPlayerDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<Player>("logged_out_player");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
}
|
||||
pub struct LoggedOutPlayerUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for LoggedOutPlayerTableHandle<'ctx> {
|
||||
type UpdateCallbackId = LoggedOutPlayerUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> LoggedOutPlayerUpdateCallbackId {
|
||||
LoggedOutPlayerUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: LoggedOutPlayerUpdateCallbackId) {
|
||||
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<Player>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `logged_out_player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`LoggedOutPlayerIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.logged_out_player().id().find(...)`.
|
||||
pub struct LoggedOutPlayerIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `logged_out_player`.
|
||||
pub fn id(&self) -> LoggedOutPlayerIdUnique<'ctx> {
|
||||
LoggedOutPlayerIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> LoggedOutPlayerIdUnique<'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<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `identity` unique index on the table `logged_out_player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`LoggedOutPlayerIdentityUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.logged_out_player().identity().find(...)`.
|
||||
pub struct LoggedOutPlayerIdentityUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `identity` unique index on the table `logged_out_player`.
|
||||
pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> {
|
||||
LoggedOutPlayerIdentityUnique {
|
||||
imp: self
|
||||
.imp
|
||||
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> {
|
||||
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Player`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait logged_out_playerQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `Player`.
|
||||
fn logged_out_player(&self) -> __sdk::__query_builder::Table<Player>;
|
||||
}
|
||||
|
||||
impl logged_out_playerQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn logged_out_player(&self) -> __sdk::__query_builder::Table<Player> {
|
||||
__sdk::__query_builder::Table::new("logged_out_player")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit 4fdb8d923f39ed592931ad4c7e6391ed99b9fe3a).
|
||||
// This was generated using spacetimedb cli version 2.0.1 (commit a4d29daec8ed35ce4913a335b7210b9ae3933d00).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
|
@ -11,11 +11,9 @@ pub mod advance_game_reducer;
|
|||
pub mod bot_table;
|
||||
pub mod bot_type;
|
||||
pub mod clear_all_reducer;
|
||||
pub mod connect_reducer;
|
||||
pub mod db_tile_type;
|
||||
pub mod db_wall_type;
|
||||
pub mod discard_tile_reducer;
|
||||
pub mod disconnect_reducer;
|
||||
pub mod dragon_type;
|
||||
pub mod game_state_type;
|
||||
pub mod game_timer_table;
|
||||
|
|
@ -24,10 +22,8 @@ pub mod hand_view_type;
|
|||
pub mod join_or_create_lobby_reducer;
|
||||
pub mod lobby_table;
|
||||
pub mod lobby_type;
|
||||
pub mod logged_out_player_table;
|
||||
pub mod player_clock_table;
|
||||
pub mod player_clock_type;
|
||||
pub mod player_hand_table;
|
||||
pub mod player_hand_type;
|
||||
pub mod player_or_bot_type;
|
||||
pub mod player_table;
|
||||
|
|
@ -35,51 +31,41 @@ pub mod player_type;
|
|||
pub mod rank_type;
|
||||
pub mod set_ready_reducer;
|
||||
pub mod suit_type;
|
||||
pub mod tile_table;
|
||||
pub mod tile_type;
|
||||
pub mod turn_state_type;
|
||||
pub mod view_closed_hands_table;
|
||||
pub mod view_hand_table;
|
||||
pub mod wall_table;
|
||||
pub mod wind_type;
|
||||
|
||||
pub use add_bot_reducer::{add_bot, set_flags_for_add_bot, AddBotCallbackId};
|
||||
pub use advance_game_reducer::{advance_game, set_flags_for_advance_game, AdvanceGameCallbackId};
|
||||
pub use add_bot_reducer::add_bot;
|
||||
pub use advance_game_reducer::advance_game;
|
||||
pub use bot_table::*;
|
||||
pub use bot_type::Bot;
|
||||
pub use clear_all_reducer::{clear_all, set_flags_for_clear_all, ClearAllCallbackId};
|
||||
pub use connect_reducer::{connect, set_flags_for_connect, ConnectCallbackId};
|
||||
pub use clear_all_reducer::clear_all;
|
||||
pub use db_tile_type::DbTile;
|
||||
pub use db_wall_type::DbWall;
|
||||
pub use discard_tile_reducer::{discard_tile, set_flags_for_discard_tile, DiscardTileCallbackId};
|
||||
pub use disconnect_reducer::{disconnect, set_flags_for_disconnect, DisconnectCallbackId};
|
||||
pub use discard_tile_reducer::discard_tile;
|
||||
pub use dragon_type::Dragon;
|
||||
pub use game_state_type::GameState;
|
||||
pub use game_timer_table::*;
|
||||
pub use game_timer_type::GameTimer;
|
||||
pub use hand_view_type::HandView;
|
||||
pub use join_or_create_lobby_reducer::{
|
||||
join_or_create_lobby, set_flags_for_join_or_create_lobby, JoinOrCreateLobbyCallbackId,
|
||||
};
|
||||
pub use join_or_create_lobby_reducer::join_or_create_lobby;
|
||||
pub use lobby_table::*;
|
||||
pub use lobby_type::Lobby;
|
||||
pub use logged_out_player_table::*;
|
||||
pub use player_clock_table::*;
|
||||
pub use player_clock_type::PlayerClock;
|
||||
pub use player_hand_table::*;
|
||||
pub use player_hand_type::PlayerHand;
|
||||
pub use player_or_bot_type::PlayerOrBot;
|
||||
pub use player_table::*;
|
||||
pub use player_type::Player;
|
||||
pub use rank_type::Rank;
|
||||
pub use set_ready_reducer::{set_flags_for_set_ready, set_ready, SetReadyCallbackId};
|
||||
pub use set_ready_reducer::set_ready;
|
||||
pub use suit_type::Suit;
|
||||
pub use tile_table::*;
|
||||
pub use tile_type::Tile;
|
||||
pub use turn_state_type::TurnState;
|
||||
pub use view_closed_hands_table::*;
|
||||
pub use view_hand_table::*;
|
||||
pub use wall_table::*;
|
||||
pub use wind_type::Wind;
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
|
|
@ -93,9 +79,7 @@ pub enum Reducer {
|
|||
AddBot { lobby_id: u32 },
|
||||
AdvanceGame { game_timer: GameTimer },
|
||||
ClearAll,
|
||||
Connect,
|
||||
DiscardTile { tile_id: u32 },
|
||||
Disconnect,
|
||||
JoinOrCreateLobby { lobby_id: u32 },
|
||||
SetReady { ready: bool },
|
||||
}
|
||||
|
|
@ -110,74 +94,40 @@ impl __sdk::Reducer for Reducer {
|
|||
Reducer::AddBot { .. } => "add_bot",
|
||||
Reducer::AdvanceGame { .. } => "advance_game",
|
||||
Reducer::ClearAll => "clear_all",
|
||||
Reducer::Connect => "connect",
|
||||
Reducer::DiscardTile { .. } => "discard_tile",
|
||||
Reducer::Disconnect => "disconnect",
|
||||
Reducer::JoinOrCreateLobby { .. } => "join_or_create_lobby",
|
||||
Reducer::SetReady { .. } => "set_ready",
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer {
|
||||
type Error = __sdk::Error;
|
||||
fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result<Self> {
|
||||
match &value.reducer_name[..] {
|
||||
"add_bot" => Ok(__sdk::parse_reducer_args::<add_bot_reducer::AddBotArgs>(
|
||||
"add_bot",
|
||||
&value.args,
|
||||
)?
|
||||
.into()),
|
||||
"advance_game" => Ok(
|
||||
__sdk::parse_reducer_args::<advance_game_reducer::AdvanceGameArgs>(
|
||||
"advance_game",
|
||||
&value.args,
|
||||
)?
|
||||
.into(),
|
||||
),
|
||||
"clear_all" => Ok(
|
||||
__sdk::parse_reducer_args::<clear_all_reducer::ClearAllArgs>(
|
||||
"clear_all",
|
||||
&value.args,
|
||||
)?
|
||||
.into(),
|
||||
),
|
||||
"connect" => Ok(__sdk::parse_reducer_args::<connect_reducer::ConnectArgs>(
|
||||
"connect",
|
||||
&value.args,
|
||||
)?
|
||||
.into()),
|
||||
"discard_tile" => Ok(
|
||||
__sdk::parse_reducer_args::<discard_tile_reducer::DiscardTileArgs>(
|
||||
"discard_tile",
|
||||
&value.args,
|
||||
)?
|
||||
.into(),
|
||||
),
|
||||
"disconnect" => Ok(
|
||||
__sdk::parse_reducer_args::<disconnect_reducer::DisconnectArgs>(
|
||||
"disconnect",
|
||||
&value.args,
|
||||
)?
|
||||
.into(),
|
||||
),
|
||||
"join_or_create_lobby" => Ok(__sdk::parse_reducer_args::<
|
||||
join_or_create_lobby_reducer::JoinOrCreateLobbyArgs,
|
||||
>("join_or_create_lobby", &value.args)?
|
||||
.into()),
|
||||
"set_ready" => Ok(
|
||||
__sdk::parse_reducer_args::<set_ready_reducer::SetReadyArgs>(
|
||||
"set_ready",
|
||||
&value.args,
|
||||
)?
|
||||
.into(),
|
||||
),
|
||||
unknown => {
|
||||
Err(
|
||||
__sdk::InternalError::unknown_name("reducer", unknown, "ReducerCallInfo")
|
||||
.into(),
|
||||
)
|
||||
#[allow(clippy::clone_on_copy)]
|
||||
fn args_bsatn(&self) -> Result<Vec<u8>, __sats::bsatn::EncodeError> {
|
||||
match self {
|
||||
Reducer::AddBot { lobby_id } => __sats::bsatn::to_vec(&add_bot_reducer::AddBotArgs {
|
||||
lobby_id: lobby_id.clone(),
|
||||
}),
|
||||
Reducer::AdvanceGame { game_timer } => {
|
||||
__sats::bsatn::to_vec(&advance_game_reducer::AdvanceGameArgs {
|
||||
game_timer: game_timer.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::ClearAll => __sats::bsatn::to_vec(&clear_all_reducer::ClearAllArgs {}),
|
||||
Reducer::DiscardTile { tile_id } => {
|
||||
__sats::bsatn::to_vec(&discard_tile_reducer::DiscardTileArgs {
|
||||
tile_id: tile_id.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::JoinOrCreateLobby { lobby_id } => {
|
||||
__sats::bsatn::to_vec(&join_or_create_lobby_reducer::JoinOrCreateLobbyArgs {
|
||||
lobby_id: lobby_id.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::SetReady { ready } => {
|
||||
__sats::bsatn::to_vec(&set_ready_reducer::SetReadyArgs {
|
||||
ready: ready.clone(),
|
||||
})
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -189,21 +139,17 @@ pub struct DbUpdate {
|
|||
bot: __sdk::TableUpdate<Bot>,
|
||||
game_timer: __sdk::TableUpdate<GameTimer>,
|
||||
lobby: __sdk::TableUpdate<Lobby>,
|
||||
logged_out_player: __sdk::TableUpdate<Player>,
|
||||
player: __sdk::TableUpdate<Player>,
|
||||
player_clock: __sdk::TableUpdate<PlayerClock>,
|
||||
player_hand: __sdk::TableUpdate<PlayerHand>,
|
||||
tile: __sdk::TableUpdate<DbTile>,
|
||||
view_closed_hands: __sdk::TableUpdate<HandView>,
|
||||
view_hand: __sdk::TableUpdate<PlayerHand>,
|
||||
wall: __sdk::TableUpdate<DbWall>,
|
||||
}
|
||||
|
||||
impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
|
||||
impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
|
||||
type Error = __sdk::Error;
|
||||
fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result<Self, Self::Error> {
|
||||
fn try_from(raw: __ws::v2::TransactionUpdate) -> Result<Self, Self::Error> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_update in raw.tables {
|
||||
for table_update in __sdk::transaction_update_iter_table_updates(raw) {
|
||||
match &table_update.table_name[..] {
|
||||
"bot" => db_update
|
||||
.bot
|
||||
|
|
@ -214,30 +160,18 @@ impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
|
|||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(lobby_table::parse_table_update(table_update)?),
|
||||
"logged_out_player" => db_update
|
||||
.logged_out_player
|
||||
.append(logged_out_player_table::parse_table_update(table_update)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(player_table::parse_table_update(table_update)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(player_clock_table::parse_table_update(table_update)?),
|
||||
"player_hand" => db_update
|
||||
.player_hand
|
||||
.append(player_hand_table::parse_table_update(table_update)?),
|
||||
"tile" => db_update
|
||||
.tile
|
||||
.append(tile_table::parse_table_update(table_update)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(view_closed_hands_table::parse_table_update(table_update)?),
|
||||
"view_hand" => db_update
|
||||
.view_hand
|
||||
.append(view_hand_table::parse_table_update(table_update)?),
|
||||
"wall" => db_update
|
||||
.wall
|
||||
.append(wall_table::parse_table_update(table_update)?),
|
||||
|
||||
unknown => {
|
||||
return Err(__sdk::InternalError::unknown_name(
|
||||
|
|
@ -273,30 +207,86 @@ impl __sdk::DbUpdate for DbUpdate {
|
|||
diff.lobby = cache
|
||||
.apply_diff_to_table::<Lobby>("lobby", &self.lobby)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.logged_out_player = cache
|
||||
.apply_diff_to_table::<Player>("logged_out_player", &self.logged_out_player)
|
||||
.with_updates_by_pk(|row| &row.identity);
|
||||
diff.player = cache
|
||||
.apply_diff_to_table::<Player>("player", &self.player)
|
||||
.with_updates_by_pk(|row| &row.identity);
|
||||
diff.player_clock = cache
|
||||
.apply_diff_to_table::<PlayerClock>("player_clock", &self.player_clock)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.player_hand = cache
|
||||
.apply_diff_to_table::<PlayerHand>("player_hand", &self.player_hand)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.tile = cache
|
||||
.apply_diff_to_table::<DbTile>("tile", &self.tile)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.wall = cache
|
||||
.apply_diff_to_table::<DbWall>("wall", &self.wall)
|
||||
.with_updates_by_pk(|row| &row.lobby_id);
|
||||
diff.view_closed_hands =
|
||||
cache.apply_diff_to_table::<HandView>("view_closed_hands", &self.view_closed_hands);
|
||||
diff.view_hand = cache.apply_diff_to_table::<PlayerHand>("view_hand", &self.view_hand);
|
||||
|
||||
diff
|
||||
}
|
||||
fn parse_initial_rows(raw: __ws::v2::QueryRows) -> __sdk::Result<Self> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_rows in raw.tables {
|
||||
match &table_rows.table[..] {
|
||||
"bot" => db_update
|
||||
.bot
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"game_timer" => db_update
|
||||
.game_timer
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"view_hand" => db_update
|
||||
.view_hand
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
unknown => {
|
||||
return Err(
|
||||
__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(db_update)
|
||||
}
|
||||
fn parse_unsubscribe_rows(raw: __ws::v2::QueryRows) -> __sdk::Result<Self> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_rows in raw.tables {
|
||||
match &table_rows.table[..] {
|
||||
"bot" => db_update
|
||||
.bot
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"game_timer" => db_update
|
||||
.game_timer
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"view_hand" => db_update
|
||||
.view_hand
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
unknown => {
|
||||
return Err(
|
||||
__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(db_update)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -306,14 +296,10 @@ pub struct AppliedDiff<'r> {
|
|||
bot: __sdk::TableAppliedDiff<'r, Bot>,
|
||||
game_timer: __sdk::TableAppliedDiff<'r, GameTimer>,
|
||||
lobby: __sdk::TableAppliedDiff<'r, Lobby>,
|
||||
logged_out_player: __sdk::TableAppliedDiff<'r, Player>,
|
||||
player: __sdk::TableAppliedDiff<'r, Player>,
|
||||
player_clock: __sdk::TableAppliedDiff<'r, PlayerClock>,
|
||||
player_hand: __sdk::TableAppliedDiff<'r, PlayerHand>,
|
||||
tile: __sdk::TableAppliedDiff<'r, DbTile>,
|
||||
view_closed_hands: __sdk::TableAppliedDiff<'r, HandView>,
|
||||
view_hand: __sdk::TableAppliedDiff<'r, PlayerHand>,
|
||||
wall: __sdk::TableAppliedDiff<'r, DbWall>,
|
||||
__unused: std::marker::PhantomData<&'r ()>,
|
||||
}
|
||||
|
||||
|
|
@ -330,26 +316,18 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
|||
callbacks.invoke_table_row_callbacks::<Bot>("bot", &self.bot, event);
|
||||
callbacks.invoke_table_row_callbacks::<GameTimer>("game_timer", &self.game_timer, event);
|
||||
callbacks.invoke_table_row_callbacks::<Lobby>("lobby", &self.lobby, event);
|
||||
callbacks.invoke_table_row_callbacks::<Player>(
|
||||
"logged_out_player",
|
||||
&self.logged_out_player,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<Player>("player", &self.player, event);
|
||||
callbacks.invoke_table_row_callbacks::<PlayerClock>(
|
||||
"player_clock",
|
||||
&self.player_clock,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<PlayerHand>("player_hand", &self.player_hand, event);
|
||||
callbacks.invoke_table_row_callbacks::<DbTile>("tile", &self.tile, event);
|
||||
callbacks.invoke_table_row_callbacks::<HandView>(
|
||||
"view_closed_hands",
|
||||
&self.view_closed_hands,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<PlayerHand>("view_hand", &self.view_hand, event);
|
||||
callbacks.invoke_table_row_callbacks::<DbWall>("wall", &self.wall, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -380,20 +358,6 @@ impl __sdk::InModule for RemoteProcedures {
|
|||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// The `set_reducer_flags` field of [`DbConnection`],
|
||||
/// with methods provided by extension traits for each reducer defined by the module.
|
||||
/// Each method sets the flags for the reducer with the same name.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub struct SetReducerFlags {
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for SetReducerFlags {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
/// The `db` field of [`EventContext`] and [`DbConnection`],
|
||||
/// with methods provided by extension traits for each table defined by the module.
|
||||
pub struct RemoteTables {
|
||||
|
|
@ -426,11 +390,6 @@ pub struct DbConnection {
|
|||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
#[doc(hidden)]
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
|
|
@ -446,7 +405,6 @@ impl __sdk::DbContext for DbConnection {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -457,9 +415,6 @@ impl __sdk::DbContext for DbConnection {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -563,7 +518,6 @@ impl __sdk::DbConnection for DbConnection {
|
|||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
|
|
@ -615,7 +569,6 @@ pub trait RemoteDbContext:
|
|||
__sdk::DbContext<
|
||||
DbView = RemoteTables,
|
||||
Reducers = RemoteReducers,
|
||||
SetReducerFlags = SetReducerFlags,
|
||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||
>
|
||||
{
|
||||
|
|
@ -624,7 +577,6 @@ impl<
|
|||
Ctx: __sdk::DbContext<
|
||||
DbView = RemoteTables,
|
||||
Reducers = RemoteReducers,
|
||||
SetReducerFlags = SetReducerFlags,
|
||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||
>,
|
||||
> RemoteDbContext for Ctx
|
||||
|
|
@ -638,11 +590,6 @@ pub struct EventContext {
|
|||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
|
|
@ -659,7 +606,6 @@ impl __sdk::AbstractEventContext for EventContext {
|
|||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
|
|
@ -675,7 +621,6 @@ impl __sdk::DbContext for EventContext {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -686,9 +631,6 @@ impl __sdk::DbContext for EventContext {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -724,11 +666,6 @@ pub struct ReducerEventContext {
|
|||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
|
|
@ -745,7 +682,6 @@ impl __sdk::AbstractEventContext for ReducerEventContext {
|
|||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
|
|
@ -761,7 +697,6 @@ impl __sdk::DbContext for ReducerEventContext {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -772,9 +707,6 @@ impl __sdk::DbContext for ReducerEventContext {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -809,11 +741,6 @@ pub struct ProcedureEventContext {
|
|||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
|
|
@ -829,7 +756,6 @@ impl __sdk::AbstractEventContext for ProcedureEventContext {
|
|||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
|
|
@ -843,7 +769,6 @@ impl __sdk::DbContext for ProcedureEventContext {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -854,9 +779,6 @@ impl __sdk::DbContext for ProcedureEventContext {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -891,11 +813,6 @@ pub struct SubscriptionEventContext {
|
|||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
|
|
@ -911,7 +828,6 @@ impl __sdk::AbstractEventContext for SubscriptionEventContext {
|
|||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
|
|
@ -925,7 +841,6 @@ impl __sdk::DbContext for SubscriptionEventContext {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -936,9 +851,6 @@ impl __sdk::DbContext for SubscriptionEventContext {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -974,11 +886,6 @@ pub struct ErrorContext {
|
|||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
|
||||
/// via extension traits implemented for [`SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub set_reducer_flags: SetReducerFlags,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
|
|
@ -995,7 +902,6 @@ impl __sdk::AbstractEventContext for ErrorContext {
|
|||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
set_reducer_flags: SetReducerFlags { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
|
|
@ -1011,7 +917,6 @@ impl __sdk::DbContext for ErrorContext {
|
|||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
|
|
@ -1022,9 +927,6 @@ impl __sdk::DbContext for ErrorContext {
|
|||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
fn set_reducer_flags(&self) -> &Self::SetReducerFlags {
|
||||
&self.set_reducer_flags
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
|
|
@ -1063,7 +965,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
|||
type Reducer = Reducer;
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type SetReducerFlags = SetReducerFlags;
|
||||
type Procedures = RemoteProcedures;
|
||||
type DbUpdate = DbUpdate;
|
||||
type AppliedDiff<'r> = AppliedDiff<'r>;
|
||||
type SubscriptionHandle = SubscriptionHandle;
|
||||
|
|
@ -1073,13 +975,18 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
|||
bot_table::register_table(client_cache);
|
||||
game_timer_table::register_table(client_cache);
|
||||
lobby_table::register_table(client_cache);
|
||||
logged_out_player_table::register_table(client_cache);
|
||||
player_table::register_table(client_cache);
|
||||
player_clock_table::register_table(client_cache);
|
||||
player_hand_table::register_table(client_cache);
|
||||
tile_table::register_table(client_cache);
|
||||
view_closed_hands_table::register_table(client_cache);
|
||||
view_hand_table::register_table(client_cache);
|
||||
wall_table::register_table(client_cache);
|
||||
}
|
||||
const ALL_TABLE_NAMES: &'static [&'static str] = &[
|
||||
"bot",
|
||||
"game_timer",
|
||||
"lobby",
|
||||
"player",
|
||||
"player_clock",
|
||||
"view_closed_hands",
|
||||
"view_hand",
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,12 +78,6 @@ 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");
|
||||
_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> {
|
||||
|
|
@ -101,17 +95,6 @@ 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()
|
||||
})
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
|
@ -172,6 +155,24 @@ impl<'ctx> PlayerClockPlayerIdUnique<'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");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __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()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `PlayerClock`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -56,3 +56,5 @@ impl __sdk::__query_builder::HasIxCols for PlayerClock {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for PlayerClock {}
|
||||
|
|
|
|||
|
|
@ -1,191 +0,0 @@
|
|||
// 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::db_tile_type::DbTile;
|
||||
use super::player_hand_type::PlayerHand;
|
||||
use super::turn_state_type::TurnState;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `player_hand`.
|
||||
///
|
||||
/// Obtain a handle from the [`PlayerHandTableAccess::player_hand`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.player_hand()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_hand().on_insert(...)`.
|
||||
pub struct PlayerHandTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<PlayerHand>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `player_hand`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait PlayerHandTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`PlayerHandTableHandle`], which mediates access to the table `player_hand`.
|
||||
fn player_hand(&self) -> PlayerHandTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl PlayerHandTableAccess for super::RemoteTables {
|
||||
fn player_hand(&self) -> PlayerHandTableHandle<'_> {
|
||||
PlayerHandTableHandle {
|
||||
imp: self.imp.get_table::<PlayerHand>("player_hand"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerHandInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct PlayerHandDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for PlayerHandTableHandle<'ctx> {
|
||||
type Row = PlayerHand;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = PlayerHand> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = PlayerHandInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerHandInsertCallbackId {
|
||||
PlayerHandInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: PlayerHandInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = PlayerHandDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerHandDeleteCallbackId {
|
||||
PlayerHandDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: PlayerHandDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<PlayerHand>("player_hand");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
||||
}
|
||||
pub struct PlayerHandUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerHandTableHandle<'ctx> {
|
||||
type UpdateCallbackId = PlayerHandUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> PlayerHandUpdateCallbackId {
|
||||
PlayerHandUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: PlayerHandUpdateCallbackId) {
|
||||
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<PlayerHand>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<PlayerHand>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `player_hand`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerHandIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_hand().id().find(...)`.
|
||||
pub struct PlayerHandIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `player_hand`.
|
||||
pub fn id(&self) -> PlayerHandIdUnique<'ctx> {
|
||||
PlayerHandIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerHandIdUnique<'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<PlayerHand> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `player_id` unique index on the table `player_hand`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerHandPlayerIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_hand().player_id().find(...)`.
|
||||
pub struct PlayerHandPlayerIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
||||
/// Get a handle on the `player_id` unique index on the table `player_hand`.
|
||||
pub fn player_id(&self) -> PlayerHandPlayerIdUnique<'ctx> {
|
||||
PlayerHandPlayerIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("player_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerHandPlayerIdUnique<'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<PlayerHand> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `PlayerHand`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait player_handQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `PlayerHand`.
|
||||
fn player_hand(&self) -> __sdk::__query_builder::Table<PlayerHand>;
|
||||
}
|
||||
|
||||
impl player_handQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn player_hand(&self) -> __sdk::__query_builder::Table<PlayerHand> {
|
||||
__sdk::__query_builder::Table::new("player_hand")
|
||||
}
|
||||
}
|
||||
|
|
@ -65,3 +65,5 @@ impl __sdk::__query_builder::HasIxCols for PlayerHand {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for PlayerHand {}
|
||||
|
|
|
|||
|
|
@ -78,12 +78,6 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<Player>("player");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
}
|
||||
pub struct PlayerUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> {
|
||||
|
|
@ -101,17 +95,6 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerIdUnique::find`] method.
|
||||
|
|
@ -174,6 +157,24 @@ impl<'ctx> PlayerIdentityUnique<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<Player>("player");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Player`.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -64,3 +64,5 @@ impl __sdk::__query_builder::HasIxCols for Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Player {}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ impl __sdk::InModule for SetReadyArgs {
|
|||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
pub struct SetReadyCallbackId(__sdk::CallbackId);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `set_ready`.
|
||||
///
|
||||
|
|
@ -31,72 +29,38 @@ pub trait set_ready {
|
|||
///
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed by listening for [`Self::on_set_ready`] callbacks.
|
||||
fn set_ready(&self, ready: bool) -> __sdk::Result<()>;
|
||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `set_ready`.
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`set_ready:set_ready_then`] to run a callback after the reducer completes.
|
||||
fn set_ready(&self, ready: bool) -> __sdk::Result<()> {
|
||||
self.set_ready_then(ready, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `set_ready` to run as soon as possible,
|
||||
/// registering `callback` to run when we are notified that the reducer completed.
|
||||
///
|
||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||
/// to determine the reducer's status.
|
||||
///
|
||||
/// The returned [`SetReadyCallbackId`] can be passed to [`Self::remove_on_set_ready`]
|
||||
/// to cancel the callback.
|
||||
fn on_set_ready(
|
||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and its status can be observed with the `callback`.
|
||||
fn set_ready_then(
|
||||
&self,
|
||||
callback: impl FnMut(&super::ReducerEventContext, &bool) + Send + 'static,
|
||||
) -> SetReadyCallbackId;
|
||||
/// Cancel a callback previously registered by [`Self::on_set_ready`],
|
||||
/// causing it not to run in the future.
|
||||
fn remove_on_set_ready(&self, callback: SetReadyCallbackId);
|
||||
ready: bool,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl set_ready for super::RemoteReducers {
|
||||
fn set_ready(&self, ready: bool) -> __sdk::Result<()> {
|
||||
self.imp.call_reducer("set_ready", SetReadyArgs { ready })
|
||||
}
|
||||
fn on_set_ready(
|
||||
fn set_ready_then(
|
||||
&self,
|
||||
mut callback: impl FnMut(&super::ReducerEventContext, &bool) + Send + 'static,
|
||||
) -> SetReadyCallbackId {
|
||||
SetReadyCallbackId(self.imp.on_reducer(
|
||||
"set_ready",
|
||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let super::ReducerEventContext {
|
||||
event:
|
||||
__sdk::ReducerEvent {
|
||||
reducer: super::Reducer::SetReady { ready },
|
||||
..
|
||||
},
|
||||
..
|
||||
} = ctx
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
callback(ctx, ready)
|
||||
}),
|
||||
))
|
||||
}
|
||||
fn remove_on_set_ready(&self, callback: SetReadyCallbackId) {
|
||||
self.imp.remove_on_reducer("set_ready", callback.0)
|
||||
}
|
||||
}
|
||||
ready: bool,
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[doc(hidden)]
|
||||
/// Extension trait for setting the call-flags for the reducer `set_ready`.
|
||||
///
|
||||
/// Implemented for [`super::SetReducerFlags`].
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
pub trait set_flags_for_set_ready {
|
||||
/// Set the call-reducer flags for the reducer `set_ready` to `flags`.
|
||||
///
|
||||
/// This type is currently unstable and may be removed without a major version bump.
|
||||
fn set_ready(&self, flags: __ws::CallReducerFlags);
|
||||
}
|
||||
|
||||
impl set_flags_for_set_ready for super::SetReducerFlags {
|
||||
fn set_ready(&self, flags: __ws::CallReducerFlags) {
|
||||
self.imp.set_call_reducer_flags("set_ready", flags);
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(SetReadyArgs { ready }, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,159 +0,0 @@
|
|||
// 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::db_tile_type::DbTile;
|
||||
use super::tile_type::Tile;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `tile`.
|
||||
///
|
||||
/// Obtain a handle from the [`TileTableAccess::tile`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.tile()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.tile().on_insert(...)`.
|
||||
pub struct TileTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<DbTile>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `tile`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait TileTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`TileTableHandle`], which mediates access to the table `tile`.
|
||||
fn tile(&self) -> TileTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl TileTableAccess for super::RemoteTables {
|
||||
fn tile(&self) -> TileTableHandle<'_> {
|
||||
TileTableHandle {
|
||||
imp: self.imp.get_table::<DbTile>("tile"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TileInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct TileDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for TileTableHandle<'ctx> {
|
||||
type Row = DbTile;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = DbTile> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = TileInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TileInsertCallbackId {
|
||||
TileInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: TileInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = TileDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TileDeleteCallbackId {
|
||||
TileDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: TileDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<DbTile>("tile");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
pub struct TileUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for TileTableHandle<'ctx> {
|
||||
type UpdateCallbackId = TileUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> TileUpdateCallbackId {
|
||||
TileUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: TileUpdateCallbackId) {
|
||||
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<DbTile>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<DbTile>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `tile`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`TileIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.tile().id().find(...)`.
|
||||
pub struct TileIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<DbTile, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> TileTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `tile`.
|
||||
pub fn id(&self) -> TileIdUnique<'ctx> {
|
||||
TileIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> TileIdUnique<'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<DbTile> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `DbTile`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait tileQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `DbTile`.
|
||||
fn tile(&self) -> __sdk::__query_builder::Table<DbTile>;
|
||||
}
|
||||
|
||||
impl tileQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn tile(&self) -> __sdk::__query_builder::Table<DbTile> {
|
||||
__sdk::__query_builder::Table::new("tile")
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::Remote
|
|||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<HandView>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<HandView>", "TableUpdate")
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::Remote
|
|||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<PlayerHand>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<PlayerHand>", "TableUpdate")
|
||||
|
|
|
|||
|
|
@ -1,159 +0,0 @@
|
|||
// 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::db_tile_type::DbTile;
|
||||
use super::db_wall_type::DbWall;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `wall`.
|
||||
///
|
||||
/// Obtain a handle from the [`WallTableAccess::wall`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.wall()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.wall().on_insert(...)`.
|
||||
pub struct WallTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<DbWall>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `wall`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait WallTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`WallTableHandle`], which mediates access to the table `wall`.
|
||||
fn wall(&self) -> WallTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl WallTableAccess for super::RemoteTables {
|
||||
fn wall(&self) -> WallTableHandle<'_> {
|
||||
WallTableHandle {
|
||||
imp: self.imp.get_table::<DbWall>("wall"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WallInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct WallDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for WallTableHandle<'ctx> {
|
||||
type Row = DbWall;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = DbWall> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = WallInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> WallInsertCallbackId {
|
||||
WallInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: WallInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = WallDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> WallDeleteCallbackId {
|
||||
WallDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: WallDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<DbWall>("wall");
|
||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||
}
|
||||
pub struct WallUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for WallTableHandle<'ctx> {
|
||||
type UpdateCallbackId = WallUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> WallUpdateCallbackId {
|
||||
WallUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: WallUpdateCallbackId) {
|
||||
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<DbWall>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<DbWall>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `lobby_id` unique index on the table `wall`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`WallLobbyIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.wall().lobby_id().find(...)`.
|
||||
pub struct WallLobbyIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<DbWall, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> WallTableHandle<'ctx> {
|
||||
/// Get a handle on the `lobby_id` unique index on the table `wall`.
|
||||
pub fn lobby_id(&self) -> WallLobbyIdUnique<'ctx> {
|
||||
WallLobbyIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("lobby_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> WallLobbyIdUnique<'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<DbWall> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `DbWall`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait wallQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `DbWall`.
|
||||
fn wall(&self) -> __sdk::__query_builder::Table<DbWall>;
|
||||
}
|
||||
|
||||
impl wallQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn wall(&self) -> __sdk::__query_builder::Table<DbWall> {
|
||||
__sdk::__query_builder::Table::new("wall")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue