Some checks failed
CI / verify (push) Has been cancelled
- lock profile task tracking scope to user - add analytics date dimension module support and tests - regenerate SpacetimeDB Rust bindings with private APIs
163 lines
5.9 KiB
Rust
163 lines
5.9 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 super::player_progression_grant_source_type::PlayerProgressionGrantSource;
|
|
use super::player_progression_type::PlayerProgression;
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
|
|
/// Table handle for the table `player_progression`.
|
|
///
|
|
/// Obtain a handle from the [`PlayerProgressionTableAccess::player_progression`] method on [`super::RemoteTables`],
|
|
/// like `ctx.db.player_progression()`.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.player_progression().on_insert(...)`.
|
|
pub struct PlayerProgressionTableHandle<'ctx> {
|
|
imp: __sdk::TableHandle<PlayerProgression>,
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the table `player_progression`.
|
|
///
|
|
/// Implemented for [`super::RemoteTables`].
|
|
pub trait PlayerProgressionTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Obtain a [`PlayerProgressionTableHandle`], which mediates access to the table `player_progression`.
|
|
fn player_progression(&self) -> PlayerProgressionTableHandle<'_>;
|
|
}
|
|
|
|
impl PlayerProgressionTableAccess for super::RemoteTables {
|
|
fn player_progression(&self) -> PlayerProgressionTableHandle<'_> {
|
|
PlayerProgressionTableHandle {
|
|
imp: self
|
|
.imp
|
|
.get_table::<PlayerProgression>("player_progression"),
|
|
ctx: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct PlayerProgressionInsertCallbackId(__sdk::CallbackId);
|
|
pub struct PlayerProgressionDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::Table for PlayerProgressionTableHandle<'ctx> {
|
|
type Row = PlayerProgression;
|
|
type EventContext = super::EventContext;
|
|
|
|
fn count(&self) -> u64 {
|
|
self.imp.count()
|
|
}
|
|
fn iter(&self) -> impl Iterator<Item = PlayerProgression> + '_ {
|
|
self.imp.iter()
|
|
}
|
|
|
|
type InsertCallbackId = PlayerProgressionInsertCallbackId;
|
|
|
|
fn on_insert(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> PlayerProgressionInsertCallbackId {
|
|
PlayerProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_insert(&self, callback: PlayerProgressionInsertCallbackId) {
|
|
self.imp.remove_on_insert(callback.0)
|
|
}
|
|
|
|
type DeleteCallbackId = PlayerProgressionDeleteCallbackId;
|
|
|
|
fn on_delete(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> PlayerProgressionDeleteCallbackId {
|
|
PlayerProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_delete(&self, callback: PlayerProgressionDeleteCallbackId) {
|
|
self.imp.remove_on_delete(callback.0)
|
|
}
|
|
}
|
|
|
|
pub struct PlayerProgressionUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerProgressionTableHandle<'ctx> {
|
|
type UpdateCallbackId = PlayerProgressionUpdateCallbackId;
|
|
|
|
fn on_update(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
) -> PlayerProgressionUpdateCallbackId {
|
|
PlayerProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_update(&self, callback: PlayerProgressionUpdateCallbackId) {
|
|
self.imp.remove_on_update(callback.0)
|
|
}
|
|
}
|
|
|
|
/// Access to the `user_id` unique index on the table `player_progression`,
|
|
/// which allows point queries on the field of the same name
|
|
/// via the [`PlayerProgressionUserIdUnique::find`] method.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.player_progression().user_id().find(...)`.
|
|
pub struct PlayerProgressionUserIdUnique<'ctx> {
|
|
imp: __sdk::UniqueConstraintHandle<PlayerProgression, String>,
|
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
impl<'ctx> PlayerProgressionTableHandle<'ctx> {
|
|
/// Get a handle on the `user_id` unique index on the table `player_progression`.
|
|
pub fn user_id(&self) -> PlayerProgressionUserIdUnique<'ctx> {
|
|
PlayerProgressionUserIdUnique {
|
|
imp: self.imp.get_unique_constraint::<String>("user_id"),
|
|
phantom: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'ctx> PlayerProgressionUserIdUnique<'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<PlayerProgression> {
|
|
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::<PlayerProgression>("player_progression");
|
|
_table.add_unique_constraint::<String>("user_id", |row| &row.user_id);
|
|
}
|
|
|
|
#[doc(hidden)]
|
|
pub(super) fn parse_table_update(
|
|
raw_updates: __ws::v2::TableUpdate,
|
|
) -> __sdk::Result<__sdk::TableUpdate<PlayerProgression>> {
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
|
__sdk::InternalError::failed_parse("TableUpdate<PlayerProgression>", "TableUpdate")
|
|
.with_cause(e)
|
|
.into()
|
|
})
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for query builder access to the table `PlayerProgression`.
|
|
///
|
|
/// Implemented for [`__sdk::QueryTableAccessor`].
|
|
pub trait player_progressionQueryTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Get a query builder for the table `PlayerProgression`.
|
|
fn player_progression(&self) -> __sdk::__query_builder::Table<PlayerProgression>;
|
|
}
|
|
|
|
impl player_progressionQueryTableAccess for __sdk::QueryTableAccessor {
|
|
fn player_progression(&self) -> __sdk::__query_builder::Table<PlayerProgression> {
|
|
__sdk::__query_builder::Table::new("player_progression")
|
|
}
|
|
}
|