165 lines
6.5 KiB
Rust
165 lines
6.5 KiB
Rust
// 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::chapter_progression_type::ChapterProgression;
|
|
use super::chapter_pace_band_type::ChapterPaceBand;
|
|
|
|
/// Table handle for the table `chapter_progression`.
|
|
///
|
|
/// Obtain a handle from the [`ChapterProgressionTableAccess::chapter_progression`] method on [`super::RemoteTables`],
|
|
/// like `ctx.db.chapter_progression()`.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.chapter_progression().on_insert(...)`.
|
|
pub struct ChapterProgressionTableHandle<'ctx> {
|
|
imp: __sdk::TableHandle<ChapterProgression>,
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the table `chapter_progression`.
|
|
///
|
|
/// Implemented for [`super::RemoteTables`].
|
|
pub trait ChapterProgressionTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Obtain a [`ChapterProgressionTableHandle`], which mediates access to the table `chapter_progression`.
|
|
fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_>;
|
|
}
|
|
|
|
impl ChapterProgressionTableAccess for super::RemoteTables {
|
|
fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_> {
|
|
ChapterProgressionTableHandle {
|
|
imp: self.imp.get_table::<ChapterProgression>("chapter_progression"),
|
|
ctx: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct ChapterProgressionInsertCallbackId(__sdk::CallbackId);
|
|
pub struct ChapterProgressionDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::Table for ChapterProgressionTableHandle<'ctx> {
|
|
type Row = ChapterProgression;
|
|
type EventContext = super::EventContext;
|
|
|
|
fn count(&self) -> u64 { self.imp.count() }
|
|
fn iter(&self) -> impl Iterator<Item = ChapterProgression> + '_ { self.imp.iter() }
|
|
|
|
type InsertCallbackId = ChapterProgressionInsertCallbackId;
|
|
|
|
fn on_insert(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> ChapterProgressionInsertCallbackId {
|
|
ChapterProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_insert(&self, callback: ChapterProgressionInsertCallbackId) {
|
|
self.imp.remove_on_insert(callback.0)
|
|
}
|
|
|
|
type DeleteCallbackId = ChapterProgressionDeleteCallbackId;
|
|
|
|
fn on_delete(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> ChapterProgressionDeleteCallbackId {
|
|
ChapterProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_delete(&self, callback: ChapterProgressionDeleteCallbackId) {
|
|
self.imp.remove_on_delete(callback.0)
|
|
}
|
|
}
|
|
|
|
pub struct ChapterProgressionUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for ChapterProgressionTableHandle<'ctx> {
|
|
type UpdateCallbackId = ChapterProgressionUpdateCallbackId;
|
|
|
|
fn on_update(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
) -> ChapterProgressionUpdateCallbackId {
|
|
ChapterProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_update(&self, callback: ChapterProgressionUpdateCallbackId) {
|
|
self.imp.remove_on_update(callback.0)
|
|
}
|
|
}
|
|
|
|
/// Access to the `chapter_progression_id` unique index on the table `chapter_progression`,
|
|
/// which allows point queries on the field of the same name
|
|
/// via the [`ChapterProgressionChapterProgressionIdUnique::find`] method.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.chapter_progression().chapter_progression_id().find(...)`.
|
|
pub struct ChapterProgressionChapterProgressionIdUnique<'ctx> {
|
|
imp: __sdk::UniqueConstraintHandle<ChapterProgression, String>,
|
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
impl<'ctx> ChapterProgressionTableHandle<'ctx> {
|
|
/// Get a handle on the `chapter_progression_id` unique index on the table `chapter_progression`.
|
|
pub fn chapter_progression_id(&self) -> ChapterProgressionChapterProgressionIdUnique<'ctx> {
|
|
ChapterProgressionChapterProgressionIdUnique {
|
|
imp: self.imp.get_unique_constraint::<String>("chapter_progression_id"),
|
|
phantom: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'ctx> ChapterProgressionChapterProgressionIdUnique<'ctx> {
|
|
/// Find the subscribed row whose `chapter_progression_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<ChapterProgression> {
|
|
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::<ChapterProgression>("chapter_progression");
|
|
_table.add_unique_constraint::<String>("chapter_progression_id", |row| &row.chapter_progression_id);
|
|
}
|
|
|
|
#[doc(hidden)]
|
|
pub(super) fn parse_table_update(
|
|
raw_updates: __ws::v2::TableUpdate,
|
|
) -> __sdk::Result<__sdk::TableUpdate<ChapterProgression>> {
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
|
__sdk::InternalError::failed_parse(
|
|
"TableUpdate<ChapterProgression>",
|
|
"TableUpdate",
|
|
).with_cause(e).into()
|
|
})
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for query builder access to the table `ChapterProgression`.
|
|
///
|
|
/// Implemented for [`__sdk::QueryTableAccessor`].
|
|
pub trait chapter_progressionQueryTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Get a query builder for the table `ChapterProgression`.
|
|
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression>;
|
|
}
|
|
|
|
impl chapter_progressionQueryTableAccess for __sdk::QueryTableAccessor {
|
|
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression> {
|
|
__sdk::__query_builder::Table::new("chapter_progression")
|
|
}
|
|
}
|
|
|