// 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::runtime_tracking_scope_kind_type::RuntimeTrackingScopeKind; use super::tracking_event_type::TrackingEvent; use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; /// Table handle for the table `tracking_event`. /// /// Obtain a handle from the [`TrackingEventTableAccess::tracking_event`] method on [`super::RemoteTables`], /// like `ctx.db.tracking_event()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.tracking_event().on_insert(...)`. pub struct TrackingEventTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `tracking_event`. /// /// Implemented for [`super::RemoteTables`]. pub trait TrackingEventTableAccess { #[allow(non_snake_case)] /// Obtain a [`TrackingEventTableHandle`], which mediates access to the table `tracking_event`. fn tracking_event(&self) -> TrackingEventTableHandle<'_>; } impl TrackingEventTableAccess for super::RemoteTables { fn tracking_event(&self) -> TrackingEventTableHandle<'_> { TrackingEventTableHandle { imp: self.imp.get_table::("tracking_event"), ctx: std::marker::PhantomData, } } } pub struct TrackingEventInsertCallbackId(__sdk::CallbackId); pub struct TrackingEventDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TrackingEventTableHandle<'ctx> { type Row = TrackingEvent; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TrackingEventInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TrackingEventInsertCallbackId { TrackingEventInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TrackingEventInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TrackingEventDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TrackingEventDeleteCallbackId { TrackingEventDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TrackingEventDeleteCallbackId) { self.imp.remove_on_delete(callback.0) } } pub struct TrackingEventUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for TrackingEventTableHandle<'ctx> { type UpdateCallbackId = TrackingEventUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> TrackingEventUpdateCallbackId { TrackingEventUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: TrackingEventUpdateCallbackId) { self.imp.remove_on_update(callback.0) } } /// Access to the `event_id` unique index on the table `tracking_event`, /// which allows point queries on the field of the same name /// via the [`TrackingEventEventIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.tracking_event().event_id().find(...)`. pub struct TrackingEventEventIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> TrackingEventTableHandle<'ctx> { /// Get a handle on the `event_id` unique index on the table `tracking_event`. pub fn event_id(&self) -> TrackingEventEventIdUnique<'ctx> { TrackingEventEventIdUnique { imp: self.imp.get_unique_constraint::("event_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> TrackingEventEventIdUnique<'ctx> { /// Find the subscribed row whose `event_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 { self.imp.find(col_val) } } #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("tracking_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 `TrackingEvent`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait tracking_eventQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `TrackingEvent`. fn tracking_event(&self) -> __sdk::__query_builder::Table; } impl tracking_eventQueryTableAccess for __sdk::QueryTableAccessor { fn tracking_event(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("tracking_event") } }