feat: add analytics metric granularity query
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-04 16:29:11 +08:00
parent 44d9bd55de
commit 1d9d8c2e41
19 changed files with 787 additions and 7 deletions

View File

@@ -0,0 +1,18 @@
// 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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct AnalyticsBucketMetric {
pub bucket_key: String,
pub bucket_start_date_key: i64,
pub bucket_end_date_key: i64,
pub value: u64,
}
impl __sdk::InModule for AnalyticsBucketMetric {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,24 @@
// 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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
#[derive(Copy, Eq, Hash)]
pub enum AnalyticsGranularity {
Day,
Week,
Month,
Quarter,
Year,
}
impl __sdk::InModule for AnalyticsGranularity {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,21 @@
// 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::analytics_granularity_type::AnalyticsGranularity;
use super::runtime_tracking_scope_kind_type::RuntimeTrackingScopeKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct AnalyticsMetricQueryInput {
pub event_key: String,
pub scope_kind: RuntimeTrackingScopeKind,
pub scope_id: String,
pub granularity: AnalyticsGranularity,
}
impl __sdk::InModule for AnalyticsMetricQueryInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,19 @@
// 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::analytics_bucket_metric_type::AnalyticsBucketMetric;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct AnalyticsMetricQueryProcedureResult {
pub ok: bool,
pub buckets: Vec<AnalyticsBucketMetric>,
pub error_message: Option<String>,
}
impl __sdk::InModule for AnalyticsMetricQueryProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -690,6 +690,12 @@ pub mod user_account_type;
pub mod user_browse_history_table;
pub mod user_browse_history_type;
pub mod analytics_bucket_metric_type;
pub mod analytics_granularity_type;
pub mod analytics_metric_query_input_type;
pub mod analytics_metric_query_procedure_result_type;
pub mod query_analytics_metric_procedure;
pub use accept_quest_reducer::accept_quest;
pub use acknowledge_quest_completion_reducer::acknowledge_quest_completion;
pub use admin_disable_profile_redeem_code_procedure::admin_disable_profile_redeem_code;
@@ -736,6 +742,10 @@ pub use analytics_date_dimension_ensure_input_type::AnalyticsDateDimensionEnsure
pub use analytics_date_dimension_seed_input_type::AnalyticsDateDimensionSeedInput;
pub use analytics_date_dimension_table::*;
pub use analytics_date_dimension_type::AnalyticsDateDimension;
pub use analytics_bucket_metric_type::AnalyticsBucketMetric;
pub use analytics_granularity_type::AnalyticsGranularity;
pub use analytics_metric_query_input_type::AnalyticsMetricQueryInput;
pub use analytics_metric_query_procedure_result_type::AnalyticsMetricQueryProcedureResult;
pub use append_ai_text_chunk_and_return_procedure::append_ai_text_chunk_and_return;
pub use apply_chapter_progression_ledger_entry_and_return_procedure::apply_chapter_progression_ledger_entry_and_return;
pub use apply_chapter_progression_ledger_entry_reducer::apply_chapter_progression_ledger_entry;
@@ -978,6 +988,7 @@ pub use get_profile_play_stats_procedure::get_profile_play_stats;
pub use get_profile_recharge_center_procedure::get_profile_recharge_center;
pub use get_profile_referral_invite_center_procedure::get_profile_referral_invite_center;
pub use get_profile_task_center_procedure::get_profile_task_center;
pub use query_analytics_metric_procedure::query_analytics_metric;
pub use get_puzzle_agent_session_procedure::get_puzzle_agent_session;
pub use get_puzzle_gallery_detail_procedure::get_puzzle_gallery_detail;
pub use get_puzzle_run_procedure::get_puzzle_run;

View File

@@ -0,0 +1,59 @@
// 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::analytics_metric_query_input_type::AnalyticsMetricQueryInput;
use super::analytics_metric_query_procedure_result_type::AnalyticsMetricQueryProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct QueryAnalyticsMetricArgs {
pub input: AnalyticsMetricQueryInput,
}
impl __sdk::InModule for QueryAnalyticsMetricArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `query_analytics_metric`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait query_analytics_metric {
fn query_analytics_metric(&self, input: AnalyticsMetricQueryInput) {
self.query_analytics_metric_then(input, |_, _| {});
}
fn query_analytics_metric_then(
&self,
input: AnalyticsMetricQueryInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AnalyticsMetricQueryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl query_analytics_metric for super::RemoteProcedures {
fn query_analytics_metric_then(
&self,
input: AnalyticsMetricQueryInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AnalyticsMetricQueryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AnalyticsMetricQueryProcedureResult>(
"query_analytics_metric",
QueryAnalyticsMetricArgs { input },
__callback,
);
}
}