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
160 lines
5.8 KiB
Rust
160 lines
5.8 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::runtime_snapshot_row_type::RuntimeSnapshotRow;
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
|
|
/// Table handle for the table `runtime_snapshot`.
|
|
///
|
|
/// Obtain a handle from the [`RuntimeSnapshotTableAccess::runtime_snapshot`] method on [`super::RemoteTables`],
|
|
/// like `ctx.db.runtime_snapshot()`.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.runtime_snapshot().on_insert(...)`.
|
|
pub struct RuntimeSnapshotTableHandle<'ctx> {
|
|
imp: __sdk::TableHandle<RuntimeSnapshotRow>,
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the table `runtime_snapshot`.
|
|
///
|
|
/// Implemented for [`super::RemoteTables`].
|
|
pub trait RuntimeSnapshotTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Obtain a [`RuntimeSnapshotTableHandle`], which mediates access to the table `runtime_snapshot`.
|
|
fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_>;
|
|
}
|
|
|
|
impl RuntimeSnapshotTableAccess for super::RemoteTables {
|
|
fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_> {
|
|
RuntimeSnapshotTableHandle {
|
|
imp: self.imp.get_table::<RuntimeSnapshotRow>("runtime_snapshot"),
|
|
ctx: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct RuntimeSnapshotInsertCallbackId(__sdk::CallbackId);
|
|
pub struct RuntimeSnapshotDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::Table for RuntimeSnapshotTableHandle<'ctx> {
|
|
type Row = RuntimeSnapshotRow;
|
|
type EventContext = super::EventContext;
|
|
|
|
fn count(&self) -> u64 {
|
|
self.imp.count()
|
|
}
|
|
fn iter(&self) -> impl Iterator<Item = RuntimeSnapshotRow> + '_ {
|
|
self.imp.iter()
|
|
}
|
|
|
|
type InsertCallbackId = RuntimeSnapshotInsertCallbackId;
|
|
|
|
fn on_insert(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> RuntimeSnapshotInsertCallbackId {
|
|
RuntimeSnapshotInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_insert(&self, callback: RuntimeSnapshotInsertCallbackId) {
|
|
self.imp.remove_on_insert(callback.0)
|
|
}
|
|
|
|
type DeleteCallbackId = RuntimeSnapshotDeleteCallbackId;
|
|
|
|
fn on_delete(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> RuntimeSnapshotDeleteCallbackId {
|
|
RuntimeSnapshotDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_delete(&self, callback: RuntimeSnapshotDeleteCallbackId) {
|
|
self.imp.remove_on_delete(callback.0)
|
|
}
|
|
}
|
|
|
|
pub struct RuntimeSnapshotUpdateCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::TableWithPrimaryKey for RuntimeSnapshotTableHandle<'ctx> {
|
|
type UpdateCallbackId = RuntimeSnapshotUpdateCallbackId;
|
|
|
|
fn on_update(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
) -> RuntimeSnapshotUpdateCallbackId {
|
|
RuntimeSnapshotUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_update(&self, callback: RuntimeSnapshotUpdateCallbackId) {
|
|
self.imp.remove_on_update(callback.0)
|
|
}
|
|
}
|
|
|
|
/// Access to the `user_id` unique index on the table `runtime_snapshot`,
|
|
/// which allows point queries on the field of the same name
|
|
/// via the [`RuntimeSnapshotUserIdUnique::find`] method.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.runtime_snapshot().user_id().find(...)`.
|
|
pub struct RuntimeSnapshotUserIdUnique<'ctx> {
|
|
imp: __sdk::UniqueConstraintHandle<RuntimeSnapshotRow, String>,
|
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
impl<'ctx> RuntimeSnapshotTableHandle<'ctx> {
|
|
/// Get a handle on the `user_id` unique index on the table `runtime_snapshot`.
|
|
pub fn user_id(&self) -> RuntimeSnapshotUserIdUnique<'ctx> {
|
|
RuntimeSnapshotUserIdUnique {
|
|
imp: self.imp.get_unique_constraint::<String>("user_id"),
|
|
phantom: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'ctx> RuntimeSnapshotUserIdUnique<'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<RuntimeSnapshotRow> {
|
|
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::<RuntimeSnapshotRow>("runtime_snapshot");
|
|
_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<RuntimeSnapshotRow>> {
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
|
__sdk::InternalError::failed_parse("TableUpdate<RuntimeSnapshotRow>", "TableUpdate")
|
|
.with_cause(e)
|
|
.into()
|
|
})
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for query builder access to the table `RuntimeSnapshotRow`.
|
|
///
|
|
/// Implemented for [`__sdk::QueryTableAccessor`].
|
|
pub trait runtime_snapshotQueryTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Get a query builder for the table `RuntimeSnapshotRow`.
|
|
fn runtime_snapshot(&self) -> __sdk::__query_builder::Table<RuntimeSnapshotRow>;
|
|
}
|
|
|
|
impl runtime_snapshotQueryTableAccess for __sdk::QueryTableAccessor {
|
|
fn runtime_snapshot(&self) -> __sdk::__query_builder::Table<RuntimeSnapshotRow> {
|
|
__sdk::__query_builder::Table::new("runtime_snapshot")
|
|
}
|
|
}
|