// 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::puzzle_event_kind_type::PuzzleEventKind; use super::puzzle_event_type::PuzzleEvent; use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; /// Table handle for the table `puzzle_event`. /// /// Obtain a handle from the [`PuzzleEventTableAccess::puzzle_event`] method on [`super::RemoteTables`], /// like `ctx.db.puzzle_event()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.puzzle_event().on_insert(...)`. pub struct PuzzleEventTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `puzzle_event`. /// /// Implemented for [`super::RemoteTables`]. pub trait PuzzleEventTableAccess { #[allow(non_snake_case)] /// Obtain a [`PuzzleEventTableHandle`], which mediates access to the table `puzzle_event`. fn puzzle_event(&self) -> PuzzleEventTableHandle<'_>; } impl PuzzleEventTableAccess for super::RemoteTables { fn puzzle_event(&self) -> PuzzleEventTableHandle<'_> { PuzzleEventTableHandle { imp: self.imp.get_table::("puzzle_event"), ctx: std::marker::PhantomData, } } } pub struct PuzzleEventInsertCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::EventTable for PuzzleEventTableHandle<'ctx> { type Row = PuzzleEvent; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PuzzleEventInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PuzzleEventInsertCallbackId { PuzzleEventInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PuzzleEventInsertCallbackId) { self.imp.remove_on_insert(callback.0) } } #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("puzzle_event"); _table.add_unique_constraint::("event_id", |row| &row.event_id); } #[doc(hidden)] pub(super) fn parse_table_update( raw_updates: __ws::v2::TableUpdate, ) -> __sdk::Result<__sdk::TableUpdate> { __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") .with_cause(e) .into() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `PuzzleEvent`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait puzzle_eventQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `PuzzleEvent`. fn puzzle_event(&self) -> __sdk::__query_builder::Table; } impl puzzle_eventQueryTableAccess for __sdk::QueryTableAccessor { fn puzzle_event(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("puzzle_event") } }