feat: add analytics date dimension bindings
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
This commit is contained in:
2026-05-04 13:41:22 +08:00
committed by 历冰郁-hermes版
parent 9f3e34e81a
commit 5c7c039e52
253 changed files with 14783 additions and 1462 deletions

View File

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