1
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use super::battle_mode_type::BattleMode;
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use super::battle_state_type::BattleState;
|
||||
use super::battle_mode_type::BattleMode;
|
||||
use super::battle_status_type::BattleStatus;
|
||||
use super::combat_outcome_type::CombatOutcome;
|
||||
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
use super::combat_outcome_type::CombatOutcome;
|
||||
|
||||
/// Table handle for the table `battle_state`.
|
||||
///
|
||||
@@ -48,12 +53,8 @@ impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> {
|
||||
type Row = BattleState;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
fn count(&self) -> u64 { self.imp.count() }
|
||||
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ { self.imp.iter() }
|
||||
|
||||
type InsertCallbackId = BattleStateInsertCallbackId;
|
||||
|
||||
@@ -99,38 +100,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `battle_state_id` unique index on the table `battle_state`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`BattleStateBattleStateIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
|
||||
pub struct BattleStateBattleStateIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> BattleStateTableHandle<'ctx> {
|
||||
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
|
||||
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
|
||||
BattleStateBattleStateIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
/// Access to the `battle_state_id` unique index on the table `battle_state`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`BattleStateBattleStateIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
|
||||
pub struct BattleStateBattleStateIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<BattleState> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
impl<'ctx> BattleStateTableHandle<'ctx> {
|
||||
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
|
||||
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
|
||||
BattleStateBattleStateIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<BattleState> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
|
||||
let _table = client_cache.get_or_make_table::<BattleState>("battle_state");
|
||||
_table.add_unique_constraint::<String>("battle_state_id", |row| &row.battle_state_id);
|
||||
}
|
||||
@@ -140,24 +142,26 @@ pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<BattleState>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<BattleState>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
__sdk::InternalError::failed_parse(
|
||||
"TableUpdate<BattleState>",
|
||||
"TableUpdate",
|
||||
).with_cause(e).into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `BattleState`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait battle_stateQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `BattleState`.
|
||||
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
|
||||
}
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `BattleState`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait battle_stateQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `BattleState`.
|
||||
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
|
||||
}
|
||||
|
||||
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
|
||||
__sdk::__query_builder::Table::new("battle_state")
|
||||
}
|
||||
}
|
||||
|
||||
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
|
||||
__sdk::__query_builder::Table::new("battle_state")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user