start render other

This commit is contained in:
Tao Tien 2026-03-09 03:33:20 -07:00
parent 8f606543f5
commit 1b5b7c9e77
8 changed files with 193 additions and 80 deletions

View file

@ -125,10 +125,41 @@ impl<'ctx> BotIdUnique<'ctx> {
}
}
/// Access to the `config_id` unique index on the table `bot`,
/// which allows point queries on the field of the same name
/// via the [`BotConfigIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.bot().config_id().find(...)`.
pub struct BotConfigIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<Bot, u32>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> BotTableHandle<'ctx> {
/// Get a handle on the `config_id` unique index on the table `bot`.
pub fn config_id(&self) -> BotConfigIdUnique<'ctx> {
BotConfigIdUnique {
imp: self.imp.get_unique_constraint::<u32>("config_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> BotConfigIdUnique<'ctx> {
/// Find the subscribed row whose `config_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<Bot> {
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::<Bot>("bot");
_table.add_unique_constraint::<u32>("id", |row| &row.id);
_table.add_unique_constraint::<u32>("config_id", |row| &row.config_id);
}
#[doc(hidden)]

View file

@ -40,6 +40,7 @@ impl __sdk::__query_builder::HasCols for Bot {
///
/// Provides typed access to indexed columns for query building.
pub struct BotIxCols {
pub config_id: __sdk::__query_builder::IxCol<Bot, u32>,
pub id: __sdk::__query_builder::IxCol<Bot, u32>,
pub lobby_id: __sdk::__query_builder::IxCol<Bot, u32>,
}
@ -48,6 +49,7 @@ impl __sdk::__query_builder::HasIxCols for Bot {
type IxCols = BotIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
BotIxCols {
config_id: __sdk::__query_builder::IxCol::new(table_name, "config_id"),
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
}