Files
Genarrative/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs
kdletters 5c7c039e52
Some checks failed
CI / verify (push) Has been cancelled
feat: add analytics date dimension bindings
- lock profile task tracking scope to user

- add analytics date dimension module support and tests

- regenerate SpacetimeDB Rust bindings with private APIs
2026-05-04 13:54:41 +08:00

160 lines
5.7 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::refresh_session_type::RefreshSession;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `refresh_session`.
///
/// Obtain a handle from the [`RefreshSessionTableAccess::refresh_session`] method on [`super::RemoteTables`],
/// like `ctx.db.refresh_session()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.refresh_session().on_insert(...)`.
pub struct RefreshSessionTableHandle<'ctx> {
imp: __sdk::TableHandle<RefreshSession>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `refresh_session`.
///
/// Implemented for [`super::RemoteTables`].
pub trait RefreshSessionTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`RefreshSessionTableHandle`], which mediates access to the table `refresh_session`.
fn refresh_session(&self) -> RefreshSessionTableHandle<'_>;
}
impl RefreshSessionTableAccess for super::RemoteTables {
fn refresh_session(&self) -> RefreshSessionTableHandle<'_> {
RefreshSessionTableHandle {
imp: self.imp.get_table::<RefreshSession>("refresh_session"),
ctx: std::marker::PhantomData,
}
}
}
pub struct RefreshSessionInsertCallbackId(__sdk::CallbackId);
pub struct RefreshSessionDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for RefreshSessionTableHandle<'ctx> {
type Row = RefreshSession;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = RefreshSession> + '_ {
self.imp.iter()
}
type InsertCallbackId = RefreshSessionInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> RefreshSessionInsertCallbackId {
RefreshSessionInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: RefreshSessionInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = RefreshSessionDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> RefreshSessionDeleteCallbackId {
RefreshSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: RefreshSessionDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct RefreshSessionUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for RefreshSessionTableHandle<'ctx> {
type UpdateCallbackId = RefreshSessionUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> RefreshSessionUpdateCallbackId {
RefreshSessionUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: RefreshSessionUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `session_id` unique index on the table `refresh_session`,
/// which allows point queries on the field of the same name
/// via the [`RefreshSessionSessionIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.refresh_session().session_id().find(...)`.
pub struct RefreshSessionSessionIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<RefreshSession, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> RefreshSessionTableHandle<'ctx> {
/// Get a handle on the `session_id` unique index on the table `refresh_session`.
pub fn session_id(&self) -> RefreshSessionSessionIdUnique<'ctx> {
RefreshSessionSessionIdUnique {
imp: self.imp.get_unique_constraint::<String>("session_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> RefreshSessionSessionIdUnique<'ctx> {
/// Find the subscribed row whose `session_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<RefreshSession> {
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::<RefreshSession>("refresh_session");
_table.add_unique_constraint::<String>("session_id", |row| &row.session_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<RefreshSession>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<RefreshSession>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `RefreshSession`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait refresh_sessionQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `RefreshSession`.
fn refresh_session(&self) -> __sdk::__query_builder::Table<RefreshSession>;
}
impl refresh_sessionQueryTableAccess for __sdk::QueryTableAccessor {
fn refresh_session(&self) -> __sdk::__query_builder::Table<RefreshSession> {
__sdk::__query_builder::Table::new("refresh_session")
}
}