// 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, }; use super::profile_membership_type::ProfileMembership; use super::runtime_profile_membership_status_type::RuntimeProfileMembershipStatus; use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier; /// Table handle for the table `profile_membership`. /// /// Obtain a handle from the [`ProfileMembershipTableAccess::profile_membership`] method on [`super::RemoteTables`], /// like `ctx.db.profile_membership()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.profile_membership().on_insert(...)`. pub struct ProfileMembershipTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `profile_membership`. /// /// Implemented for [`super::RemoteTables`]. pub trait ProfileMembershipTableAccess { #[allow(non_snake_case)] /// Obtain a [`ProfileMembershipTableHandle`], which mediates access to the table `profile_membership`. fn profile_membership(&self) -> ProfileMembershipTableHandle<'_>; } impl ProfileMembershipTableAccess for super::RemoteTables { fn profile_membership(&self) -> ProfileMembershipTableHandle<'_> { ProfileMembershipTableHandle { imp: self.imp.get_table::("profile_membership"), ctx: std::marker::PhantomData, } } } pub struct ProfileMembershipInsertCallbackId(__sdk::CallbackId); pub struct ProfileMembershipDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for ProfileMembershipTableHandle<'ctx> { type Row = ProfileMembership; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = ProfileMembershipInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> ProfileMembershipInsertCallbackId { ProfileMembershipInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: ProfileMembershipInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = ProfileMembershipDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> ProfileMembershipDeleteCallbackId { ProfileMembershipDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: ProfileMembershipDeleteCallbackId) { self.imp.remove_on_delete(callback.0) } } pub struct ProfileMembershipUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for ProfileMembershipTableHandle<'ctx> { type UpdateCallbackId = ProfileMembershipUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> ProfileMembershipUpdateCallbackId { ProfileMembershipUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: ProfileMembershipUpdateCallbackId) { self.imp.remove_on_update(callback.0) } } /// Access to the `user_id` unique index on the table `profile_membership`, /// which allows point queries on the field of the same name /// via the [`ProfileMembershipUserIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.profile_membership().user_id().find(...)`. pub struct ProfileMembershipUserIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> ProfileMembershipTableHandle<'ctx> { /// Get a handle on the `user_id` unique index on the table `profile_membership`. pub fn user_id(&self) -> ProfileMembershipUserIdUnique<'ctx> { ProfileMembershipUserIdUnique { imp: self.imp.get_unique_constraint::("user_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> ProfileMembershipUserIdUnique<'ctx> { /// Find the subscribed row whose `user_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::("profile_membership"); _table.add_unique_constraint::("user_id", |row| &row.user_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 `ProfileMembership`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait profile_membershipQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `ProfileMembership`. fn profile_membership(&self) -> __sdk::__query_builder::Table; } impl profile_membershipQueryTableAccess for __sdk::QueryTableAccessor { fn profile_membership(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("profile_membership") } }