Merge branch 'master' of http://82.157.175.59:3000/GenarrativeAI/Genarrative
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-05 14:58:07 +08:00
238 changed files with 29234 additions and 144 deletions

View File

@@ -25,6 +25,7 @@ module-puzzle = { path = "../module-puzzle" }
module-runtime = { path = "../module-runtime" }
module-runtime-story = { path = "../module-runtime-story" }
module-runtime-item = { path = "../module-runtime-item" }
module-square-hole = { path = "../module-square-hole" }
module-story = { path = "../module-story" }
platform-auth = { path = "../platform-auth" }
platform-llm = { path = "../platform-llm" }

View File

@@ -109,16 +109,24 @@ use crate::{
admin_list_profile_invite_codes, admin_list_profile_redeem_codes,
admin_list_profile_task_configs, admin_upsert_profile_invite_code,
admin_upsert_profile_redeem_code, admin_upsert_profile_task_config,
claim_profile_task_reward, create_profile_recharge_order, get_profile_dashboard,
get_profile_play_stats, get_profile_recharge_center, get_profile_referral_invite_center,
get_profile_task_center, get_profile_wallet_ledger, redeem_profile_referral_invite_code,
redeem_profile_reward_code,
claim_profile_task_reward, create_profile_recharge_order, get_profile_analytics_metric,
get_profile_dashboard, get_profile_play_stats, get_profile_recharge_center,
get_profile_referral_invite_center, get_profile_task_center, get_profile_wallet_ledger,
redeem_profile_referral_invite_code, redeem_profile_reward_code,
},
runtime_save::{
delete_runtime_snapshot, get_runtime_snapshot, list_profile_save_archives,
put_runtime_snapshot, resume_profile_save_archive,
},
runtime_settings::{get_runtime_settings, put_runtime_settings},
square_hole::{
compile_square_hole_agent_draft, create_square_hole_agent_session, delete_square_hole_work,
drop_square_hole_shape, execute_square_hole_agent_action, finish_square_hole_time_up,
get_square_hole_agent_session, get_square_hole_run, get_square_hole_work_detail,
get_square_hole_works, list_square_hole_gallery, publish_square_hole_work,
put_square_hole_work, restart_square_hole_run, start_square_hole_run, stop_square_hole_run,
stream_square_hole_agent_message, submit_square_hole_agent_message,
},
state::AppState,
story_battles::{
create_story_battle, create_story_npc_battle, get_story_battle_state, resolve_story_battle,
@@ -829,6 +837,119 @@ pub fn build_router(state: AppState) -> Router {
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions",
post(create_square_hole_agent_session).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions/{session_id}",
get(get_square_hole_agent_session).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions/{session_id}/messages",
post(submit_square_hole_agent_message).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions/{session_id}/messages/stream",
post(stream_square_hole_agent_message).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions/{session_id}/actions",
post(execute_square_hole_agent_action).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/sessions/{session_id}/compile",
post(compile_square_hole_agent_draft).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/works",
get(get_square_hole_works).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/works/{profile_id}",
get(get_square_hole_work_detail)
.patch(put_square_hole_work)
.put(put_square_hole_work)
.delete(delete_square_hole_work)
.route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/creation/square-hole/works/{profile_id}/publish",
post(publish_square_hole_work).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/gallery",
get(list_square_hole_gallery),
)
.route(
"/api/runtime/square-hole/works/{profile_id}/runs",
post(start_square_hole_run).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/runs/{run_id}",
get(get_square_hole_run).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/runs/{run_id}/drop",
post(drop_square_hole_shape).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/runs/{run_id}/stop",
post(stop_square_hole_run).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/runs/{run_id}/restart",
post(restart_square_hole_run).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/square-hole/runs/{run_id}/time-up",
post(finish_square_hole_time_up).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/puzzle/agent/sessions",
post(create_puzzle_agent_session)
@@ -1081,6 +1202,13 @@ pub fn build_router(state: AppState) -> Router {
require_bearer_auth,
)),
)
.route(
"/api/profile/analytics/metric",
get(get_profile_analytics_metric).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/profile/tasks",
get(get_profile_task_center).route_layer(middleware::from_fn_with_state(

View File

@@ -64,8 +64,12 @@ where
};
turn_output.map_err(|error| match error {
CreationAgentJsonTurnFailure::Stream(_) => {
build_error(messages.generation_failed.to_string())
CreationAgentJsonTurnFailure::Stream(error) => {
tracing::warn!(
error = %error,
"创作 Agent 流式 LLM 请求失败"
);
build_error(format!("{}{error}", messages.generation_failed))
}
CreationAgentJsonTurnFailure::Parse => build_error(messages.parse_failed.to_string()),
})

View File

@@ -61,6 +61,8 @@ mod runtime_profile;
mod runtime_save;
mod runtime_settings;
mod session_client;
mod square_hole;
mod square_hole_agent_turn;
mod state;
mod story_battles;
mod story_sessions;

View File

@@ -4,6 +4,7 @@ pub(crate) mod character_visual;
pub(crate) mod puzzle;
pub(crate) mod rpg;
pub(crate) mod scene_background;
pub(crate) mod square_hole;
pub(crate) use rpg::agent_chat;
pub(crate) use rpg::foundation_draft;

View File

@@ -0,0 +1,164 @@
use serde_json::{Value as JsonValue, json};
use spacetime_client::{SquareHoleAgentMessageRecord, SquareHoleAgentSessionRecord};
use crate::creation_agent_chat::render_quick_fill_extra_rules;
/// 方洞挑战共创 Agent 的系统提示词。
///
/// 这里只定义模型职责与输出约束,具体的模型调用、解析和写库由方洞 Agent turn 负责。
pub(crate) const SQUARE_HOLE_AGENT_SYSTEM_PROMPT: &str = r#"你是一个负责和百梦主共创“方洞挑战”竖屏玩法的中文创意策划。
你要把用户灵感收束成一个反直觉形状分拣小游戏:玩家会本能把形状投入对应洞口,但真实规则可能让所有形状都优先进入方洞,形成类似参考视频“所有东西都进方洞”的喜剧反差。
你必须同时输出:
1. 一段直接发给用户的中文回复 replyText
2. 当前进度 progressPercent
3. 下一轮完整可用的 nextConfig
硬约束:
1. 只能输出 JSON不能输出代码块或解释
2. nextConfig 必须是完整对象,不能只输出 patch
3. replyText 必须是自然中文不能提“字段”“结构”“JSON”“后端”等内部词
4. replyText 一次最多推进一个最关键问题
5. 如果用户要求自动配置,就直接补齐可发布草稿需要的题材、反差规则、形状数量和难度,不要继续提问
6. 默认核心反差优先使用“方洞万能”或“方洞优先”,但可以根据用户题材包装成更有记忆点的规则
7. progressPercent 范围只能是 0 到 100
8. shapeCount 只能是 6 到 24 的整数difficulty 只能是 1 到 10 的整数
"#;
const SQUARE_HOLE_AGENT_OUTPUT_CONTRACT: &str = r#"请严格按以下 JSON 输出,不要输出其他文字:
{
"replyText": "",
"progressPercent": 0,
"nextConfig": {
"themeText": "",
"twistRule": "",
"shapeCount": 12,
"difficulty": 4
}
}"#;
pub(crate) const SQUARE_HOLE_AGENT_JSON_TURN_USER_PROMPT: &str = "请按约定输出这一轮的 JSON。";
/// 方洞挑战草稿生成对话提示词脚本。
///
/// 方洞首版只需要四个可写回 SpacetimeDB 的配置项,因此提示词直接围绕配置收束,
/// 不在模型输出层引入额外锚点,避免和当前持久化 schema 产生漂移。
pub(crate) fn build_square_hole_agent_prompt(
session: &SquareHoleAgentSessionRecord,
quick_fill_requested: bool,
) -> String {
let quick_fill_rules = if quick_fill_requested {
format!(
"\n\n{}",
render_quick_fill_extra_rules(
"当前方洞挑战方向里的题材、反差规则、形状数量和难度",
"不要要求用户再提供洞口、形状、演出或难度信息",
"输出完整 nextConfig直接补齐空缺或仍过于泛化的项",
"生成结果页",
)
)
} else {
String::new()
};
format!(
"模板目标:收束成可试玩、可发布的方洞挑战玩法草稿。{quick_fill_rules}\n\n当前是第 {turn} 轮,当前进度 {progress}% 。\n\n是否要求自动配置:{quick_fill_requested_text}\n\n当前配置:\n{current_config}\n\n最近聊天记录:\n{chat_history}\n\n收束要求:\n1. themeText 描述本局的玩具、道具或场景题材,保持短句。\n2. twistRule 描述真实判定规则,优先体现方洞优先或类似反直觉逻辑。\n3. shapeCount 决定单局形状数量,移动端短局建议 8 到 16。\n4. difficulty 决定误导强度和节奏,建议 3 到 7。\n5. 用户给出明确方向时优先吸收并推进,不要机械问完四个问题。\n\n{contract}",
quick_fill_rules = quick_fill_rules,
turn = session.current_turn.saturating_add(1),
progress = session.progress_percent,
quick_fill_requested_text = if quick_fill_requested { "" } else { "" },
current_config = serialize_square_hole_session_config(session),
chat_history =
serde_json::to_string_pretty(&build_chat_history(session.messages.as_slice()))
.unwrap_or_else(|_| "[]".to_string()),
contract = SQUARE_HOLE_AGENT_OUTPUT_CONTRACT,
)
}
fn serialize_square_hole_session_config(session: &SquareHoleAgentSessionRecord) -> String {
serde_json::to_string_pretty(&json!({
"themeText": session.config.theme_text,
"twistRule": session.config.twist_rule,
"shapeCount": session.config.shape_count,
"difficulty": session.config.difficulty,
}))
.unwrap_or_else(|_| "{}".to_string())
}
fn build_chat_history(messages: &[SquareHoleAgentMessageRecord]) -> Vec<JsonValue> {
messages
.iter()
.map(|message| {
json!({
"role": message.role,
"kind": message.kind,
"content": message.text,
})
})
.collect()
}
#[cfg(test)]
mod tests {
use super::build_square_hole_agent_prompt;
fn message(role: &str, text: &str) -> spacetime_client::SquareHoleAgentMessageRecord {
spacetime_client::SquareHoleAgentMessageRecord {
id: format!("message-{role}"),
role: role.to_string(),
kind: "chat".to_string(),
text: text.to_string(),
created_at: "2026-05-04T10:00:00.000Z".to_string(),
}
}
fn session_record() -> spacetime_client::SquareHoleAgentSessionRecord {
spacetime_client::SquareHoleAgentSessionRecord {
session_id: "square-hole-session-test".to_string(),
current_turn: 1,
progress_percent: 25,
stage: "collecting_config".to_string(),
anchor_pack: spacetime_client::SquareHoleAnchorPackRecord {
theme: anchor("theme", "题材主题", "积木纸箱"),
twist_rule: anchor("twistRule", "反差规则", ""),
shape_count: anchor("shapeCount", "形状数量", "12"),
difficulty: anchor("difficulty", "难度", "4"),
},
config: spacetime_client::SquareHoleCreatorConfigRecord {
theme_text: "积木纸箱".to_string(),
twist_rule: "方洞万能".to_string(),
shape_count: 12,
difficulty: 4,
},
draft: None,
messages: vec![message("user", "做成办公室文具版")],
last_assistant_reply: Some("这次可以从办公室文具题材开始。".to_string()),
published_profile_id: None,
updated_at: "2026-05-04T10:00:00.000Z".to_string(),
}
}
fn anchor(key: &str, label: &str, value: &str) -> spacetime_client::SquareHoleAnchorItemRecord {
spacetime_client::SquareHoleAnchorItemRecord {
key: key.to_string(),
label: label.to_string(),
value: value.to_string(),
status: if value.is_empty() {
"missing"
} else {
"confirmed"
}
.to_string(),
}
}
#[test]
fn quick_fill_prompt_requires_complete_config() {
let prompt = build_square_hole_agent_prompt(&session_record(), true);
assert!(prompt.contains("用户刚刚主动要求你自动补充剩余关键字"));
assert!(prompt.contains("不要再继续提问"));
assert!(prompt.contains("nextConfig"));
assert!(prompt.contains("progressPercent 直接输出为 100"));
}
}

View File

@@ -1,11 +1,11 @@
use axum::{
Json,
extract::{Extension, Path, State},
extract::{Extension, Path, Query, State},
http::StatusCode,
response::Response,
};
use module_runtime::{
PROFILE_RECHARGE_PAYMENT_CHANNEL_MOCK, RuntimeProfileInviteCodeRecord,
AnalyticsGranularity, PROFILE_RECHARGE_PAYMENT_CHANNEL_MOCK, RuntimeProfileInviteCodeRecord,
RuntimeProfileMembershipBenefitRecord, RuntimeProfileRechargeCenterRecord,
RuntimeProfileRechargeOrderRecord, RuntimeProfileRechargeProductRecord,
RuntimeProfileRedeemCodeMode, RuntimeProfileRedeemCodeRecord,
@@ -15,10 +15,12 @@ use module_runtime::{
RuntimeReferralInviteCenterRecord, RuntimeTrackingScopeKind,
};
use serde_json::{Value, json};
use serde::Deserialize;
use shared_contracts::runtime::{
AdminDisableProfileRedeemCodeRequest, AdminDisableProfileTaskConfigRequest,
AdminUpsertProfileInviteCodeRequest, AdminUpsertProfileRedeemCodeRequest,
AdminUpsertProfileTaskConfigRequest, ClaimProfileTaskRewardResponse,
AdminUpsertProfileTaskConfigRequest, AnalyticsBucketMetricResponse,
AnalyticsMetricQueryResponse, ClaimProfileTaskRewardResponse,
CreateProfileRechargeOrderRequest, CreateProfileRechargeOrderResponse,
PROFILE_TASK_CYCLE_DAILY, PROFILE_TASK_STATUS_CLAIMABLE, PROFILE_TASK_STATUS_CLAIMED,
PROFILE_TASK_STATUS_DISABLED, PROFILE_TASK_STATUS_INCOMPLETE,
@@ -31,6 +33,8 @@ use shared_contracts::runtime::{
PROFILE_WALLET_LEDGER_SOURCE_TYPE_POINTS_RECHARGE,
PROFILE_WALLET_LEDGER_SOURCE_TYPE_PUZZLE_AUTHOR_INCENTIVE_CLAIM,
PROFILE_WALLET_LEDGER_SOURCE_TYPE_REDEEM_CODE_REWARD,
ANALYTICS_GRANULARITY_DAY, ANALYTICS_GRANULARITY_MONTH, ANALYTICS_GRANULARITY_QUARTER,
ANALYTICS_GRANULARITY_WEEK, ANALYTICS_GRANULARITY_YEAR,
PROFILE_WALLET_LEDGER_SOURCE_TYPE_SNAPSHOT_SYNC, ProfileDashboardSummaryResponse,
ProfileInviteCodeAdminListResponse, ProfileInviteCodeAdminResponse,
ProfileMembershipBenefitResponse, ProfileMembershipResponse, ProfilePlayStatsResponse,
@@ -44,6 +48,7 @@ use shared_contracts::runtime::{
RedeemProfileRewardCodeRequest, RedeemProfileRewardCodeResponse, TRACKING_SCOPE_KIND_MODULE,
TRACKING_SCOPE_KIND_SITE, TRACKING_SCOPE_KIND_USER, TRACKING_SCOPE_KIND_WORK,
};
use shared_kernel::{offset_datetime_to_unix_micros, parse_rfc3339};
use spacetime_client::SpacetimeClientError;
use time::OffsetDateTime;
@@ -277,6 +282,51 @@ pub async fn redeem_profile_reward_code(
))
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AnalyticsMetricQueryParams {
pub event_key: String,
pub scope_kind: String,
pub scope_id: String,
pub granularity: String,
}
pub async fn get_profile_analytics_metric(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(_authenticated): Extension<AuthenticatedAccessToken>,
Query(query): Query<AnalyticsMetricQueryParams>,
) -> Result<Json<Value>, Response> {
let scope_kind = parse_tracking_scope_kind(&query.scope_kind).map_err(|error| {
runtime_profile_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST).with_message(error),
)
})?;
let granularity = parse_analytics_granularity(&query.granularity).map_err(|error| {
runtime_profile_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST).with_message(error),
)
})?;
let record = state
.spacetime_client()
.query_analytics_metric(query.event_key, scope_kind, query.scope_id, granularity)
.await
.map_err(|error| {
runtime_profile_error_response(
&request_context,
map_runtime_profile_client_error(error),
)
})?;
Ok(json_success_body(
Some(&request_context),
build_analytics_metric_query_response(record),
))
}
pub async fn get_profile_task_center(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
@@ -369,6 +419,14 @@ pub async fn admin_upsert_profile_task_config(
AppError::from_status(StatusCode::BAD_REQUEST).with_message(error),
)
})?;
// 中文注释:个人任务配置首版只开放 User scopeHTTP 层先返回清晰错误,领域层再兜底。
if scope_kind != RuntimeTrackingScopeKind::User {
return Err(runtime_profile_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST)
.with_message("个人任务 scopeKind 首版仅支持 user"),
));
}
let updated_at_micros = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000;
let record = state
.spacetime_client()
@@ -558,6 +616,10 @@ pub async fn admin_upsert_profile_invite_code(
) -> Result<Json<Value>, Response> {
let metadata_json = normalize_admin_invite_code_metadata(payload.metadata)
.map_err(|error| runtime_profile_error_response(&request_context, error))?;
let starts_at_micros = parse_admin_invite_code_time_field("startsAt", payload.starts_at)
.map_err(|error| runtime_profile_error_response(&request_context, error))?;
let expires_at_micros = parse_admin_invite_code_time_field("expiresAt", payload.expires_at)
.map_err(|error| runtime_profile_error_response(&request_context, error))?;
let updated_at_micros = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000;
let record = state
.spacetime_client()
@@ -565,6 +627,8 @@ pub async fn admin_upsert_profile_invite_code(
admin.session().username.clone(),
payload.invite_code,
metadata_json,
starts_at_micros,
expires_at_micros,
updated_at_micros as i64,
)
.await
@@ -796,6 +860,23 @@ fn build_profile_task_center_response(
}
}
fn build_analytics_metric_query_response(
record: module_runtime::AnalyticsMetricQueryResponse,
) -> AnalyticsMetricQueryResponse {
AnalyticsMetricQueryResponse {
buckets: record
.buckets
.into_iter()
.map(|bucket| AnalyticsBucketMetricResponse {
bucket_key: bucket.bucket_key,
bucket_start_date_key: bucket.bucket_start_date_key,
bucket_end_date_key: bucket.bucket_end_date_key,
value: bucket.value,
})
.collect(),
}
}
fn build_profile_task_item_response(
record: RuntimeProfileTaskItemRecord,
) -> ProfileTaskItemResponse {
@@ -873,6 +954,27 @@ fn normalize_admin_invite_code_metadata(metadata: Option<Value>) -> Result<Strin
Ok(metadata_json)
}
fn parse_admin_invite_code_time_field(
field: &'static str,
value: Option<String>,
) -> Result<Option<i64>, AppError> {
let Some(value) = value else {
return Ok(None);
};
let value = value.trim();
if value.is_empty() {
return Ok(None);
}
let parsed = parse_rfc3339(value).map_err(|error| {
AppError::from_status(StatusCode::BAD_REQUEST)
.with_message(format!("邀请码 {field} 必须是 RFC3339 时间字符串"))
.with_details(json!({ "field": field, "message": error }))
})?;
Ok(Some(offset_datetime_to_unix_micros(parsed)))
}
fn parse_profile_redeem_code_mode(raw: &str) -> Result<RuntimeProfileRedeemCodeMode, String> {
match raw.trim().to_ascii_lowercase().as_str() {
"public" => Ok(RuntimeProfileRedeemCodeMode::Public),
@@ -899,6 +1001,17 @@ fn parse_tracking_scope_kind(raw: &str) -> Result<RuntimeTrackingScopeKind, Stri
}
}
fn parse_analytics_granularity(raw: &str) -> Result<AnalyticsGranularity, String> {
match raw.trim().to_ascii_lowercase().as_str() {
ANALYTICS_GRANULARITY_DAY => Ok(AnalyticsGranularity::Day),
ANALYTICS_GRANULARITY_WEEK => Ok(AnalyticsGranularity::Week),
ANALYTICS_GRANULARITY_MONTH => Ok(AnalyticsGranularity::Month),
ANALYTICS_GRANULARITY_QUARTER => Ok(AnalyticsGranularity::Quarter),
ANALYTICS_GRANULARITY_YEAR => Ok(AnalyticsGranularity::Year),
_ => Err("统计粒度无效".to_string()),
}
}
fn format_profile_task_cycle(cycle: RuntimeProfileTaskCycle) -> &'static str {
match cycle {
RuntimeProfileTaskCycle::Daily => PROFILE_TASK_CYCLE_DAILY,
@@ -932,6 +1045,9 @@ fn build_profile_invite_code_admin_response(
user_id: record.user_id,
invite_code: record.invite_code,
metadata,
starts_at: record.starts_at,
expires_at: record.expires_at,
status: record.status.as_str().to_string(),
created_at: record.created_at,
updated_at: record.updated_at,
}
@@ -1256,9 +1372,8 @@ mod tests {
#[tokio::test]
async fn admin_profile_task_routes_require_admin_authentication() {
let app = build_router(
AppState::new(admin_enabled_test_config()).expect("state should build"),
);
let app =
build_router(AppState::new(admin_enabled_test_config()).expect("state should build"));
let list_response = app
.clone()
@@ -1302,9 +1417,8 @@ mod tests {
#[tokio::test]
async fn admin_profile_code_list_routes_require_admin_authentication() {
let app = build_router(
AppState::new(admin_enabled_test_config()).expect("state should build"),
);
let app =
build_router(AppState::new(admin_enabled_test_config()).expect("state should build"));
for uri in [
"/admin/api/profile/redeem-codes",

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,307 @@
use module_square_hole::{
SQUARE_HOLE_MAX_DIFFICULTY, SQUARE_HOLE_MAX_SHAPE_COUNT, SQUARE_HOLE_MIN_DIFFICULTY,
SQUARE_HOLE_MIN_SHAPE_COUNT,
};
use platform_llm::LlmClient;
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use spacetime_client::{SquareHoleAgentMessageFinalizeRecordInput, SquareHoleAgentSessionRecord};
use crate::creation_agent_llm_turn::{
CreationAgentLlmTurnErrorMessages, stream_creation_agent_json_turn,
};
use crate::prompt::square_hole::{
SQUARE_HOLE_AGENT_JSON_TURN_USER_PROMPT, SQUARE_HOLE_AGENT_SYSTEM_PROMPT,
build_square_hole_agent_prompt,
};
#[derive(Clone, Debug)]
pub(crate) struct SquareHoleAgentTurnRequest<'a> {
pub llm_client: Option<&'a LlmClient>,
pub session: &'a SquareHoleAgentSessionRecord,
pub quick_fill_requested: bool,
pub enable_web_search: bool,
}
#[derive(Clone, Debug)]
pub(crate) struct SquareHoleAgentTurnResult {
pub assistant_reply_text: String,
pub stage: String,
pub progress_percent: u32,
pub config_json: String,
pub error_message: Option<String>,
}
#[derive(Clone, Debug)]
pub(crate) struct SquareHoleAgentTurnError {
message: String,
}
impl SquareHoleAgentTurnError {
fn new(message: impl Into<String>) -> Self {
Self {
message: message.into(),
}
}
}
impl std::fmt::Display for SquareHoleAgentTurnError {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str(&self.message)
}
}
impl std::error::Error for SquareHoleAgentTurnError {}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleAgentModelOutput {
reply_text: String,
progress_percent: u32,
next_config: SquareHoleAgentConfigOutput,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleAgentConfigOutput {
theme_text: String,
twist_rule: String,
shape_count: u32,
difficulty: u32,
}
pub(crate) async fn run_square_hole_agent_turn<F>(
request: SquareHoleAgentTurnRequest<'_>,
on_reply_update: F,
) -> Result<SquareHoleAgentTurnResult, SquareHoleAgentTurnError>
where
F: FnMut(&str),
{
let prompt = build_square_hole_agent_prompt(request.session, request.quick_fill_requested);
let turn_output = stream_creation_agent_json_turn(
request.llm_client,
format!("{SQUARE_HOLE_AGENT_SYSTEM_PROMPT}\n\n{prompt}"),
SQUARE_HOLE_AGENT_JSON_TURN_USER_PROMPT,
request.enable_web_search,
CreationAgentLlmTurnErrorMessages {
model_unavailable: "当前模型不可用,请稍后重试。",
generation_failed: "方洞挑战聊天生成失败,请稍后重试。",
parse_failed: "方洞挑战聊天结果解析失败,请稍后重试。",
},
on_reply_update,
SquareHoleAgentTurnError::new,
)
.await?;
let output = parse_model_output(&turn_output.parsed, request.session)?;
let progress_percent = if request.quick_fill_requested {
100
} else {
output.progress_percent.min(100)
};
Ok(SquareHoleAgentTurnResult {
assistant_reply_text: output.reply_text,
stage: resolve_stage(progress_percent),
progress_percent,
config_json: serde_json::to_string(&output.next_config)
.map_err(|_| SquareHoleAgentTurnError::new("方洞挑战配置序列化失败。"))?,
error_message: None,
})
}
pub(crate) fn build_finalize_record_input(
session_id: String,
owner_user_id: String,
assistant_message_id: String,
result: SquareHoleAgentTurnResult,
updated_at_micros: i64,
) -> SquareHoleAgentMessageFinalizeRecordInput {
SquareHoleAgentMessageFinalizeRecordInput {
session_id,
owner_user_id,
assistant_message_id: Some(assistant_message_id),
assistant_reply_text: Some(result.assistant_reply_text),
config_json: Some(result.config_json),
progress_percent: result.progress_percent,
stage: result.stage,
updated_at_micros,
error_message: result.error_message,
}
}
fn parse_model_output(
parsed: &JsonValue,
session: &SquareHoleAgentSessionRecord,
) -> Result<SquareHoleAgentModelOutput, SquareHoleAgentTurnError> {
let reply_text = parsed
.get("replyText")
.and_then(JsonValue::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.ok_or_else(|| SquareHoleAgentTurnError::new("方洞挑战聊天结果缺少有效回复,请稍后重试。"))?
.to_string();
let progress_percent = parsed
.get("progressPercent")
.and_then(JsonValue::as_u64)
.map(|value| value.min(100) as u32)
.unwrap_or(session.progress_percent);
let next_config_value = parsed
.get("nextConfig")
.ok_or_else(|| SquareHoleAgentTurnError::new("方洞挑战聊天结果缺少 nextConfig。"))?;
let next_config = parse_model_config(next_config_value, session)?;
Ok(SquareHoleAgentModelOutput {
reply_text,
progress_percent,
next_config,
})
}
fn parse_model_config(
value: &JsonValue,
session: &SquareHoleAgentSessionRecord,
) -> Result<SquareHoleAgentConfigOutput, SquareHoleAgentTurnError> {
if !value.is_object() {
return Err(SquareHoleAgentTurnError::new(
"方洞挑战聊天结果中的 nextConfig 必须是对象。",
));
}
Ok(SquareHoleAgentConfigOutput {
theme_text: read_text_field(value, "themeText")
.unwrap_or_else(|| session.config.theme_text.clone()),
twist_rule: read_text_field(value, "twistRule")
.unwrap_or_else(|| session.config.twist_rule.clone()),
shape_count: read_u32_field(value, "shapeCount")
.unwrap_or(session.config.shape_count)
.clamp(SQUARE_HOLE_MIN_SHAPE_COUNT, SQUARE_HOLE_MAX_SHAPE_COUNT),
difficulty: read_u32_field(value, "difficulty")
.unwrap_or(session.config.difficulty)
.clamp(SQUARE_HOLE_MIN_DIFFICULTY, SQUARE_HOLE_MAX_DIFFICULTY),
})
}
fn read_text_field(value: &JsonValue, field_name: &str) -> Option<String> {
value
.get(field_name)
.and_then(JsonValue::as_str)
.map(str::trim)
.filter(|text| !text.is_empty())
.map(str::to_string)
}
fn read_u32_field(value: &JsonValue, field_name: &str) -> Option<u32> {
value
.get(field_name)
.and_then(JsonValue::as_u64)
.and_then(|number| u32::try_from(number).ok())
}
fn resolve_stage(progress_percent: u32) -> String {
if progress_percent >= 100 {
"ReadyToCompile"
} else {
"Collecting"
}
.to_string()
}
#[cfg(test)]
mod tests {
use serde_json::json;
use super::{parse_model_output, resolve_stage};
fn session_record() -> spacetime_client::SquareHoleAgentSessionRecord {
spacetime_client::SquareHoleAgentSessionRecord {
session_id: "square-hole-session-test".to_string(),
current_turn: 1,
progress_percent: 25,
stage: "collecting_config".to_string(),
anchor_pack: spacetime_client::SquareHoleAnchorPackRecord {
theme: anchor("theme", "题材主题", "纸箱"),
twist_rule: anchor("twistRule", "反差规则", "方洞万能"),
shape_count: anchor("shapeCount", "形状数量", "12"),
difficulty: anchor("difficulty", "难度", "4"),
},
config: spacetime_client::SquareHoleCreatorConfigRecord {
theme_text: "纸箱".to_string(),
twist_rule: "方洞万能".to_string(),
shape_count: 12,
difficulty: 4,
},
draft: None,
messages: Vec::new(),
last_assistant_reply: None,
published_profile_id: None,
updated_at: "2026-05-04T10:00:00.000Z".to_string(),
}
}
fn anchor(key: &str, label: &str, value: &str) -> spacetime_client::SquareHoleAnchorItemRecord {
spacetime_client::SquareHoleAnchorItemRecord {
key: key.to_string(),
label: label.to_string(),
value: value.to_string(),
status: if value.is_empty() {
"missing"
} else {
"confirmed"
}
.to_string(),
}
}
#[test]
fn parse_model_output_accepts_camel_case_config_contract() {
let model_output = json!({
"replyText": "可以,把办公室文具都做成会被方洞吞进去的挑战。",
"progressPercent": 86,
"nextConfig": {
"themeText": "办公室文具",
"twistRule": "所有文具最终都优先进入方洞",
"shapeCount": 14,
"difficulty": 6
}
});
let output =
parse_model_output(&model_output, &session_record()).expect("模型输出应能解析");
assert_eq!(
output.reply_text,
"可以,把办公室文具都做成会被方洞吞进去的挑战。"
);
assert_eq!(output.progress_percent, 86);
assert_eq!(output.next_config.theme_text, "办公室文具");
assert_eq!(output.next_config.twist_rule, "所有文具最终都优先进入方洞");
assert_eq!(output.next_config.shape_count, 14);
assert_eq!(output.next_config.difficulty, 6);
}
#[test]
fn parse_model_output_clamps_numeric_config() {
let model_output = json!({
"replyText": "我先把数字压到可试玩范围里。",
"progressPercent": 120,
"nextConfig": {
"themeText": "霓虹积木",
"twistRule": "方洞优先",
"shapeCount": 99,
"difficulty": 0
}
});
let output =
parse_model_output(&model_output, &session_record()).expect("模型输出应能解析");
assert_eq!(output.progress_percent, 100);
assert_eq!(output.next_config.shape_count, 24);
assert_eq!(output.next_config.difficulty, 1);
}
#[test]
fn resolve_stage_switches_to_compile_only_at_complete_progress() {
assert_eq!(resolve_stage(99), "Collecting");
assert_eq!(resolve_stage(100), "ReadyToCompile");
}
}

View File

@@ -4,6 +4,7 @@
use serde_json::Value;
use shared_kernel::{offset_datetime_to_unix_micros, parse_rfc3339};
use std::collections::BTreeMap;
use crate::domain::*;
use crate::errors::RuntimeProfileFieldError;
@@ -223,6 +224,189 @@ pub fn runtime_profile_beijing_day_key(now_micros: i64) -> i64 {
.div_euclid(PROFILE_RUNTIME_DAY_MICROS)
}
/// 从 YYYY-MM-DD 解析分析业务日 date_key。
///
/// 这里故意不引入时区库date_key 本身就是“北京时间日历日期自 Unix 纪元起的天数”。
pub fn parse_analytics_calendar_date_key(
calendar_date: &str,
) -> Result<i64, RuntimeProfileFieldError> {
let (year, month, day) = parse_calendar_date_parts(calendar_date)?;
validate_calendar_date(year, month, day)?;
let date_key = days_from_civil(year, month, day);
validate_analytics_date_dimension_date_key(date_key)?;
Ok(date_key)
}
/// 校验分析日期维表 date_key 是否位于业务允许范围内。
///
/// 裸 i64 date_key 可由 reducer 直接传入,因此在进入日历算法前先限制范围,避免极端输入
/// 生成无意义日期或触发整数边界风险。
pub fn validate_analytics_date_dimension_date_key(
date_key: i64,
) -> Result<(), RuntimeProfileFieldError> {
let min_date_key = days_from_civil(2000, 1, 1);
let max_date_key = days_from_civil(2100, 12, 31);
if date_key < min_date_key || date_key > max_date_key {
return Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate);
}
Ok(())
}
pub fn build_analytics_date_dimension_from_date_key(
date_key: i64,
) -> AnalyticsDateDimensionSnapshot {
let (year, month, day) = civil_from_days(date_key);
let weekday = weekday_from_date_key(date_key);
let iso_week_key = iso_week_key(year, month, day, weekday);
let week_start_date_key = date_key - i64::from(weekday - 1);
let week_end_date_key = week_start_date_key + 6;
let month_start_date_key = days_from_civil(year, month, 1);
let month_end_date_key = days_from_civil(year, month, days_in_month(year, month));
let quarter = (month - 1) / 3 + 1;
let quarter_start_month = (quarter - 1) * 3 + 1;
let quarter_end_month = quarter_start_month + 2;
let quarter_start_date_key = days_from_civil(year, quarter_start_month, 1);
let quarter_end_date_key = days_from_civil(
year,
quarter_end_month,
days_in_month(year, quarter_end_month),
);
let year_start_date_key = days_from_civil(year, 1, 1);
let year_end_date_key = days_from_civil(year, 12, 31);
AnalyticsDateDimensionSnapshot {
date_key,
calendar_date: format!("{year:04}-{month:02}-{day:02}"),
weekday,
iso_week_key,
week_start_date_key,
week_end_date_key,
month_key: year * 100 + i32::from(month),
month_start_date_key,
month_end_date_key,
quarter_key: year * 10 + i32::from(quarter),
quarter_start_date_key,
quarter_end_date_key,
year_key: year,
year_start_date_key,
year_end_date_key,
}
}
fn parse_calendar_date_parts(
calendar_date: &str,
) -> Result<(i32, u8, u8), RuntimeProfileFieldError> {
let mut parts = calendar_date.trim().split('-');
let year = parts
.next()
.and_then(|value| value.parse::<i32>().ok())
.ok_or(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)?;
let month = parts
.next()
.and_then(|value| value.parse::<u8>().ok())
.ok_or(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)?;
let day = parts
.next()
.and_then(|value| value.parse::<u8>().ok())
.ok_or(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)?;
if parts.next().is_some() {
return Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate);
}
Ok((year, month, day))
}
fn validate_calendar_date(year: i32, month: u8, day: u8) -> Result<(), RuntimeProfileFieldError> {
if !(1..=12).contains(&month) || day == 0 || day > days_in_month(year, month) {
return Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate);
}
Ok(())
}
fn days_in_month(year: i32, month: u8) -> u8 {
match month {
1 | 3 | 5 | 7 | 8 | 10 | 12 => 31,
4 | 6 | 9 | 11 => 30,
2 if is_leap_year(year) => 29,
2 => 28,
_ => 0,
}
}
fn is_leap_year(year: i32) -> bool {
(year % 4 == 0 && year % 100 != 0) || year % 400 == 0
}
fn weekday_from_date_key(date_key: i64) -> u8 {
// 中文注释1970-01-01 是周四;这里返回 ISO weekday周一=1周日=7。
(date_key + 3).rem_euclid(7) as u8 + 1
}
fn iso_week_key(year: i32, month: u8, day: u8, weekday: u8) -> i32 {
let ordinal = ordinal_day(year, month, day);
let week = (i32::from(ordinal) - i32::from(weekday) + 10).div_euclid(7);
let iso_year = if week < 1 {
year - 1
} else if week > iso_weeks_in_year(year) {
year + 1
} else {
year
};
let iso_week = if week < 1 {
iso_weeks_in_year(year - 1)
} else if week > iso_weeks_in_year(year) {
1
} else {
week
};
iso_year * 100 + iso_week
}
fn ordinal_day(year: i32, month: u8, day: u8) -> u16 {
(1..month)
.map(|current_month| u16::from(days_in_month(year, current_month)))
.sum::<u16>()
+ u16::from(day)
}
fn iso_weeks_in_year(year: i32) -> i32 {
let jan_first_weekday = weekday_from_date_key(days_from_civil(year, 1, 1));
if jan_first_weekday == 4 || (jan_first_weekday == 3 && is_leap_year(year)) {
53
} else {
52
}
}
fn days_from_civil(year: i32, month: u8, day: u8) -> i64 {
// 中文注释Howard Hinnant civil calendar 算法,返回 1970-01-01 起的日序号。
let adjusted_year = year - if month <= 2 { 1 } else { 0 };
let era = adjusted_year.div_euclid(400);
let year_of_era = adjusted_year - era * 400;
let month = i32::from(month);
let day = i32::from(day);
let month_prime = month + if month > 2 { -3 } else { 9 };
let day_of_year = (153 * month_prime + 2) / 5 + day - 1;
let day_of_era = year_of_era * 365 + year_of_era / 4 - year_of_era / 100 + day_of_year;
i64::from(era * 146_097 + day_of_era - 719_468)
}
fn civil_from_days(date_key: i64) -> (i32, u8, u8) {
// 中文注释days_from_civil 的反向算法,避免依赖运行环境时区。
let z = date_key + 719_468;
let era = z.div_euclid(146_097);
let day_of_era = z - era * 146_097;
let year_of_era = (day_of_era - day_of_era / 1_460 + day_of_era / 36_524
- day_of_era / 146_096)
.div_euclid(365);
let mut year = year_of_era + era * 400;
let day_of_year = day_of_era - (365 * year_of_era + year_of_era / 4 - year_of_era / 100);
let month_prime = (5 * day_of_year + 2).div_euclid(153);
let day = day_of_year - (153 * month_prime + 2).div_euclid(5) + 1;
let month = month_prime + if month_prime < 10 { 3 } else { -9 };
year += if month <= 2 { 1 } else { 0 };
(year as i32, month as u8, day as u8)
}
pub fn build_default_runtime_profile_task_config(
updated_at_micros: i64,
updated_by: String,
@@ -319,6 +503,81 @@ pub fn build_runtime_tracking_daily_stat_id(
)
}
pub fn aggregate_runtime_tracking_daily_stats(
stats: Vec<RuntimeAnalyticsDailyStatSnapshot>,
event_key: &str,
scope_kind: RuntimeTrackingScopeKind,
scope_id: &str,
granularity: AnalyticsGranularity,
) -> Vec<AnalyticsBucketMetric> {
let mut buckets: BTreeMap<(String, i64, i64), u64> = BTreeMap::new();
let event_key = event_key.trim();
let scope_id = scope_id.trim();
for stat in stats {
if stat.event_key.trim() != event_key
|| stat.scope_kind != scope_kind
|| stat.scope_id.trim() != scope_id
{
continue;
}
let dimension = build_analytics_date_dimension_from_date_key(stat.day_key);
let (bucket_key, bucket_start_date_key, bucket_end_date_key) =
analytics_bucket_for_dimension(&dimension, granularity);
*buckets
.entry((bucket_key, bucket_start_date_key, bucket_end_date_key))
.or_insert(0) += u64::from(stat.count);
}
buckets
.into_iter()
.map(
|((bucket_key, bucket_start_date_key, bucket_end_date_key), value)| {
AnalyticsBucketMetric {
bucket_key,
bucket_start_date_key,
bucket_end_date_key,
value,
}
},
)
.collect()
}
fn analytics_bucket_for_dimension(
dimension: &AnalyticsDateDimensionSnapshot,
granularity: AnalyticsGranularity,
) -> (String, i64, i64) {
match granularity {
AnalyticsGranularity::Day => (
dimension.calendar_date.clone(),
dimension.date_key,
dimension.date_key,
),
AnalyticsGranularity::Week => (
dimension.iso_week_key.to_string(),
dimension.week_start_date_key,
dimension.week_end_date_key,
),
AnalyticsGranularity::Month => (
dimension.month_key.to_string(),
dimension.month_start_date_key,
dimension.month_end_date_key,
),
AnalyticsGranularity::Quarter => (
dimension.quarter_key.to_string(),
dimension.quarter_start_date_key,
dimension.quarter_end_date_key,
),
AnalyticsGranularity::Year => (
dimension.year_key.to_string(),
dimension.year_start_date_key,
dimension.year_end_date_key,
),
}
}
pub fn build_runtime_profile_task_config_record(
snapshot: RuntimeProfileTaskConfigSnapshot,
) -> RuntimeProfileTaskConfigRecord {
@@ -416,10 +675,21 @@ pub fn build_runtime_profile_redeem_code_record(
pub fn build_runtime_profile_invite_code_record(
snapshot: RuntimeProfileInviteCodeSnapshot,
) -> RuntimeProfileInviteCodeRecord {
let status = crate::commands::resolve_runtime_profile_invite_code_status(
snapshot.starts_at_micros,
snapshot.expires_at_micros,
snapshot.updated_at_micros,
);
RuntimeProfileInviteCodeRecord {
user_id: snapshot.user_id,
invite_code: snapshot.invite_code,
metadata_json: snapshot.metadata_json,
starts_at: snapshot.starts_at_micros.map(format_utc_micros),
starts_at_micros: snapshot.starts_at_micros,
expires_at: snapshot.expires_at_micros.map(format_utc_micros),
expires_at_micros: snapshot.expires_at_micros,
status,
created_at: format_utc_micros(snapshot.created_at_micros),
created_at_micros: snapshot.created_at_micros,
updated_at: format_utc_micros(snapshot.updated_at_micros),

View File

@@ -89,8 +89,8 @@ pub fn build_runtime_tracking_event_input(
) -> Result<RuntimeTrackingEventInput, RuntimeProfileFieldError> {
let event_id = normalize_required_string(event_id)
.ok_or(RuntimeProfileFieldError::MissingTrackingEventId)?;
let event_key =
normalize_required_string(event_key).ok_or(RuntimeProfileFieldError::MissingTaskEventKey)?;
let event_key = normalize_required_string(event_key)
.ok_or(RuntimeProfileFieldError::MissingTaskEventKey)?;
let scope_id = normalize_required_string(scope_id)
.ok_or(RuntimeProfileFieldError::MissingTrackingScopeId)?;
let metadata_json = normalize_tracking_metadata_json(metadata_json)?;
@@ -116,6 +116,24 @@ pub fn build_runtime_profile_task_center_get_input(
Ok(RuntimeProfileTaskCenterGetInput { user_id })
}
pub fn build_analytics_metric_query_input(
event_key: String,
scope_kind: RuntimeTrackingScopeKind,
scope_id: String,
granularity: AnalyticsGranularity,
) -> Result<AnalyticsMetricQueryInput, RuntimeProfileFieldError> {
let event_key = normalize_required_string(event_key)
.ok_or(RuntimeProfileFieldError::MissingTaskEventKey)?;
let scope_id = normalize_required_string(scope_id)
.ok_or(RuntimeProfileFieldError::MissingTrackingScopeId)?;
Ok(AnalyticsMetricQueryInput {
event_key,
scope_kind,
scope_id,
granularity,
})
}
pub fn build_runtime_profile_task_claim_input(
user_id: String,
task_id: String,
@@ -151,8 +169,12 @@ pub fn build_runtime_profile_task_config_admin_upsert_input(
let task_id = normalize_profile_task_id(task_id)?;
let title =
normalize_required_string(title).ok_or(RuntimeProfileFieldError::MissingTaskTitle)?;
let event_key =
normalize_required_string(event_key).ok_or(RuntimeProfileFieldError::MissingTaskEventKey)?;
let event_key = normalize_required_string(event_key)
.ok_or(RuntimeProfileFieldError::MissingTaskEventKey)?;
// 中文注释:个人任务首版只按用户维度累计,避免 site/work/module 误复用用户桶。
if scope_kind != RuntimeTrackingScopeKind::User {
return Err(RuntimeProfileFieldError::UnsupportedProfileTaskScopeKind);
}
if threshold == 0 {
return Err(RuntimeProfileFieldError::InvalidTaskThreshold);
}
@@ -326,17 +348,25 @@ pub fn build_runtime_profile_invite_code_admin_upsert_input(
admin_user_id: String,
invite_code: String,
metadata_json: String,
starts_at_micros: Option<i64>,
expires_at_micros: Option<i64>,
updated_at_micros: i64,
) -> Result<RuntimeProfileInviteCodeAdminUpsertInput, RuntimeProfileFieldError> {
let admin_user_id = normalize_runtime_profile_user_id(admin_user_id)?;
let invite_code =
normalize_invite_code(invite_code).ok_or(RuntimeProfileFieldError::MissingInviteCode)?;
let metadata_json = normalize_invite_code_metadata_json(metadata_json)?;
crate::commands::validate_runtime_profile_invite_code_validity_window(
starts_at_micros,
expires_at_micros,
)?;
Ok(RuntimeProfileInviteCodeAdminUpsertInput {
admin_user_id,
invite_code,
metadata_json,
starts_at_micros,
expires_at_micros,
updated_at_micros,
})
}
@@ -639,6 +669,40 @@ pub fn normalize_invite_code_metadata_json(
serde_json::to_string(&parsed).map_err(|_| RuntimeProfileFieldError::InvalidInviteCodeMetadata)
}
pub fn validate_runtime_profile_invite_code_validity_window(
starts_at_micros: Option<i64>,
expires_at_micros: Option<i64>,
) -> Result<(), RuntimeProfileFieldError> {
if matches!((starts_at_micros, expires_at_micros), (Some(starts_at), Some(expires_at)) if starts_at > expires_at)
{
return Err(RuntimeProfileFieldError::InvalidInviteCodeValidityWindow);
}
Ok(())
}
pub fn resolve_runtime_profile_invite_code_status(
starts_at_micros: Option<i64>,
expires_at_micros: Option<i64>,
now_micros: i64,
) -> RuntimeProfileInviteCodeStatus {
if starts_at_micros
.map(|starts_at| now_micros < starts_at)
.unwrap_or(false)
{
return RuntimeProfileInviteCodeStatus::Pending;
}
if expires_at_micros
.map(|expires_at| now_micros >= expires_at)
.unwrap_or(false)
{
return RuntimeProfileInviteCodeStatus::Expired;
}
RuntimeProfileInviteCodeStatus::Active
}
fn normalize_tracking_metadata_json(value: String) -> Result<String, RuntimeProfileFieldError> {
let trimmed = value.trim();
if trimmed.is_empty() {

View File

@@ -21,6 +21,10 @@ pub const PROFILE_INVITE_CODE_METADATA_DEFAULT_JSON: &str = "{}";
pub const PROFILE_INVITE_CODE_METADATA_MAX_BYTES: usize = 4096;
pub const PROFILE_RUNTIME_DAY_MICROS: i64 = 86_400_000_000;
pub const PROFILE_TASK_BEIJING_OFFSET_MICROS: i64 = 28_800_000_000;
pub const ANALYTICS_DATE_DIMENSION_MAX_SEED_DAYS: i64 = 3_660;
// 中文注释:日期维表当前只预置运营统计可接受的业务日期范围,避免裸 date_key 极值进入日历算法。
pub const ANALYTICS_DATE_DIMENSION_MIN_DATE: &str = "2000-01-01";
pub const ANALYTICS_DATE_DIMENSION_MAX_DATE: &str = "2100-12-31";
pub const PROFILE_TASK_ID_DAILY_LOGIN: &str = "daily_login";
pub const PROFILE_TASK_EVENT_KEY_DAILY_LOGIN: &str = "daily_login";
pub const PROFILE_TASK_DEFAULT_TITLE_DAILY_LOGIN: &str = "每日登录";
@@ -30,6 +34,102 @@ pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
pub const DEFAULT_SAVE_ARCHIVE_SUMMARY_TEXT: &str = "继续推进上一次保存的故事。";
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_MOCK: &str = "mock";
/// 分析日期维表的纯领域快照。
///
/// date_key 沿用现有北京时间自然日桶floor((occurred_at_micros + 8h) / 1d)。
/// calendar_date 使用该业务日对应的公历日期,格式固定为 YYYY-MM-DD。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnalyticsDateDimensionSnapshot {
pub date_key: i64,
pub calendar_date: String,
pub weekday: u8,
pub iso_week_key: i32,
pub week_start_date_key: i64,
pub week_end_date_key: i64,
pub month_key: i32,
pub month_start_date_key: i64,
pub month_end_date_key: i64,
pub quarter_key: i32,
pub quarter_start_date_key: i64,
pub quarter_end_date_key: i64,
pub year_key: i32,
pub year_start_date_key: i64,
pub year_end_date_key: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum AnalyticsGranularity {
Day,
Week,
Month,
Quarter,
Year,
}
impl AnalyticsGranularity {
pub fn as_str(&self) -> &'static str {
match self {
Self::Day => "day",
Self::Week => "week",
Self::Month => "month",
Self::Quarter => "quarter",
Self::Year => "year",
}
}
pub fn from_client_str(value: &str) -> Option<Self> {
match value.trim().to_ascii_lowercase().as_str() {
"day" => Some(Self::Day),
"week" => Some(Self::Week),
"month" => Some(Self::Month),
"quarter" => Some(Self::Quarter),
"year" => Some(Self::Year),
_ => None,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RuntimeAnalyticsDailyStatSnapshot {
pub event_key: String,
pub scope_kind: RuntimeTrackingScopeKind,
pub scope_id: String,
pub day_key: i64,
pub count: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnalyticsBucketMetric {
pub bucket_key: String,
pub bucket_start_date_key: i64,
pub bucket_end_date_key: i64,
pub value: u64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AnalyticsMetricQueryRequest {
pub event_key: String,
pub scope_kind: RuntimeTrackingScopeKind,
pub scope_id: String,
pub granularity: AnalyticsGranularity,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AnalyticsMetricQueryResponse {
pub buckets: Vec<AnalyticsBucketMetric>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnalyticsMetricQueryProcedureResult {
pub ok: bool,
pub buckets: Vec<AnalyticsBucketMetric>,
pub error_message: Option<String>,
}
/// 运行时平台主题。
///
/// 当前只冻结 light/dark 两种主题,避免各层散落字符串字面量。
@@ -411,6 +511,24 @@ impl RuntimeProfileTaskStatus {
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeProfileInviteCodeStatus {
Pending,
Active,
Expired,
}
impl RuntimeProfileInviteCodeStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Pending => "pending",
Self::Active => "active",
Self::Expired => "expired",
}
}
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeTrackingEventInput {
@@ -506,6 +624,15 @@ pub struct RuntimeProfileTaskCenterGetInput {
pub user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AnalyticsMetricQueryInput {
pub event_key: String,
pub scope_kind: RuntimeTrackingScopeKind,
pub scope_id: String,
pub granularity: AnalyticsGranularity,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileTaskClaimInput {
@@ -904,6 +1031,8 @@ pub struct RuntimeProfileInviteCodeAdminUpsertInput {
pub admin_user_id: String,
pub invite_code: String,
pub metadata_json: String,
pub starts_at_micros: Option<i64>,
pub expires_at_micros: Option<i64>,
pub updated_at_micros: i64,
}
@@ -919,6 +1048,8 @@ pub struct RuntimeProfileInviteCodeSnapshot {
pub user_id: String,
pub invite_code: String,
pub metadata_json: String,
pub starts_at_micros: Option<i64>,
pub expires_at_micros: Option<i64>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
@@ -1289,6 +1420,11 @@ pub struct RuntimeProfileInviteCodeRecord {
pub user_id: String,
pub invite_code: String,
pub metadata_json: String,
pub starts_at: Option<String>,
pub starts_at_micros: Option<i64>,
pub expires_at: Option<String>,
pub expires_at_micros: Option<i64>,
pub status: RuntimeProfileInviteCodeStatus,
pub created_at: String,
pub created_at_micros: i64,
pub updated_at: String,

View File

@@ -52,6 +52,7 @@ pub enum RuntimeProfileFieldError {
InvalidRedeemCodeReward,
InvalidRedeemCodeMaxUses,
InvalidInviteCodeMetadata,
InvalidInviteCodeValidityWindow,
MissingTaskId,
MissingTaskTitle,
MissingTaskEventKey,
@@ -59,6 +60,7 @@ pub enum RuntimeProfileFieldError {
MissingTrackingScopeId,
InvalidTaskCycle,
InvalidTaskScopeKind,
UnsupportedProfileTaskScopeKind,
InvalidTaskThreshold,
InvalidTaskReward,
TaskDisabled,
@@ -77,6 +79,7 @@ pub enum RuntimeProfileFieldError {
actual_session_id: String,
},
NonPersistentRuntimeSnapshot,
InvalidAnalyticsCalendarDate,
}
impl std::fmt::Display for RuntimeProfileFieldError {
@@ -98,6 +101,7 @@ impl std::fmt::Display for RuntimeProfileFieldError {
Self::InvalidInviteCodeMetadata => {
f.write_str("邀请码 metadata 必须是合法 JSON object")
}
Self::InvalidInviteCodeValidityWindow => f.write_str("邀请码开始时间不能晚于截止时间"),
Self::MissingTaskId => f.write_str("profile_task.task_id 不能为空"),
Self::MissingTaskTitle => f.write_str("profile_task.title 不能为空"),
Self::MissingTaskEventKey => f.write_str("profile_task.event_key 不能为空"),
@@ -105,6 +109,9 @@ impl std::fmt::Display for RuntimeProfileFieldError {
Self::MissingTrackingScopeId => f.write_str("tracking_event.scope_id 不能为空"),
Self::InvalidTaskCycle => f.write_str("profile_task.cycle 无效"),
Self::InvalidTaskScopeKind => f.write_str("profile_task.scope_kind 无效"),
Self::UnsupportedProfileTaskScopeKind => {
f.write_str("个人任务 scope_kind 首版仅支持 user")
}
Self::InvalidTaskThreshold => f.write_str("profile_task.threshold 必须大于 0"),
Self::InvalidTaskReward => f.write_str("profile_task.reward_points 必须大于 0"),
Self::TaskDisabled => f.write_str("任务已停用"),
@@ -130,6 +137,9 @@ impl std::fmt::Display for RuntimeProfileFieldError {
Self::NonPersistentRuntimeSnapshot => {
f.write_str("预览或测试运行态不能创建正式 checkpoint")
}
Self::InvalidAnalyticsCalendarDate => {
f.write_str("analytics_date_dimension.calendar_date 必须是合法 YYYY-MM-DD 日期")
}
}
}
}

View File

@@ -1,4 +1,4 @@
mod application;
mod application;
mod commands;
mod domain;
mod errors;
@@ -465,6 +465,57 @@ mod tests {
);
}
#[test]
fn analytics_date_dimension_handles_iso_week_across_year() {
let date_key = parse_analytics_calendar_date_key("2024-12-31").unwrap();
let dimension = build_analytics_date_dimension_from_date_key(date_key);
assert_eq!(dimension.calendar_date, "2024-12-31");
assert_eq!(dimension.weekday, 2);
assert_eq!(dimension.iso_week_key, 202501);
assert_eq!(
dimension.week_start_date_key,
parse_analytics_calendar_date_key("2024-12-30").unwrap()
);
assert_eq!(
dimension.week_end_date_key,
parse_analytics_calendar_date_key("2025-01-05").unwrap()
);
}
#[test]
fn analytics_date_dimension_handles_leap_day() {
let date_key = parse_analytics_calendar_date_key("2024-02-29").unwrap();
let dimension = build_analytics_date_dimension_from_date_key(date_key);
assert_eq!(dimension.calendar_date, "2024-02-29");
assert_eq!(dimension.weekday, 4);
assert_eq!(dimension.month_key, 202402);
assert_eq!(dimension.month_end_date_key, date_key);
assert_eq!(dimension.quarter_key, 20241);
}
#[test]
fn analytics_date_dimension_handles_quarter_boundary() {
let date_key = parse_analytics_calendar_date_key("2024-04-01").unwrap();
let dimension = build_analytics_date_dimension_from_date_key(date_key);
assert_eq!(dimension.quarter_key, 20242);
assert_eq!(dimension.quarter_start_date_key, date_key);
assert_eq!(
dimension.quarter_end_date_key,
parse_analytics_calendar_date_key("2024-06-30").unwrap()
);
assert_eq!(
dimension.year_start_date_key,
parse_analytics_calendar_date_key("2024-01-01").unwrap()
);
assert_eq!(
dimension.year_end_date_key,
parse_analytics_calendar_date_key("2024-12-31").unwrap()
);
}
#[test]
fn runtime_profile_task_status_matches_progress_and_claim() {
assert_eq!(
@@ -525,6 +576,51 @@ mod tests {
);
}
#[test]
fn build_task_config_input_accepts_only_user_scope() {
let input = build_runtime_profile_task_config_admin_upsert_input(
"admin".to_string(),
PROFILE_TASK_ID_DAILY_LOGIN.to_string(),
"每日登录".to_string(),
"".to_string(),
PROFILE_TASK_EVENT_KEY_DAILY_LOGIN.to_string(),
RuntimeProfileTaskCycle::Daily,
RuntimeTrackingScopeKind::User,
1,
10,
true,
10,
1,
)
.expect("user scope should be accepted");
assert_eq!(input.scope_kind, RuntimeTrackingScopeKind::User);
for scope_kind in [
RuntimeTrackingScopeKind::Site,
RuntimeTrackingScopeKind::Module,
RuntimeTrackingScopeKind::Work,
] {
assert_eq!(
build_runtime_profile_task_config_admin_upsert_input(
"admin".to_string(),
PROFILE_TASK_ID_DAILY_LOGIN.to_string(),
"每日登录".to_string(),
"".to_string(),
PROFILE_TASK_EVENT_KEY_DAILY_LOGIN.to_string(),
RuntimeProfileTaskCycle::Daily,
scope_kind,
1,
10,
true,
10,
1,
)
.expect_err("non-user scope should fail"),
RuntimeProfileFieldError::UnsupportedProfileTaskScopeKind
);
}
}
#[test]
fn recharge_product_catalog_matches_reference_prices() {
let point_products = runtime_profile_recharge_point_products();

View File

@@ -0,0 +1,148 @@
use module_runtime::{
AnalyticsDateDimensionSnapshot, RuntimeProfileFieldError,
build_analytics_date_dimension_from_date_key, parse_analytics_calendar_date_key,
validate_analytics_date_dimension_date_key,
};
fn dimension(calendar_date: &str) -> AnalyticsDateDimensionSnapshot {
let date_key = parse_analytics_calendar_date_key(calendar_date).expect("日期应可解析");
build_analytics_date_dimension_from_date_key(date_key)
}
fn date_key(calendar_date: &str) -> i64 {
parse_analytics_calendar_date_key(calendar_date).expect("日期应可解析")
}
#[test]
fn analytics_date_dimension_handles_leap_day() {
// 中文注释2024 是闰年2 月应包含 29 日且属于 ISO 第 9 周。
let snapshot = dimension("2024-02-29");
assert_eq!(snapshot.calendar_date, "2024-02-29");
assert_eq!(snapshot.weekday, 4);
assert_eq!(snapshot.iso_week_key, 202409);
assert_eq!(snapshot.week_start_date_key, date_key("2024-02-26"));
assert_eq!(snapshot.week_end_date_key, date_key("2024-03-03"));
assert_eq!(snapshot.month_key, 202402);
assert_eq!(snapshot.month_start_date_key, date_key("2024-02-01"));
assert_eq!(snapshot.month_end_date_key, date_key("2024-02-29"));
assert_eq!(snapshot.quarter_key, 20241);
assert_eq!(snapshot.year_key, 2024);
}
#[test]
fn analytics_date_dimension_uses_iso_week_year_across_year_boundary() {
// 中文注释2025-12-29 是周一,但 ISO week-year 已经进入 2026-W01。
let snapshot = dimension("2025-12-29");
assert_eq!(snapshot.calendar_date, "2025-12-29");
assert_eq!(snapshot.weekday, 1);
assert_eq!(snapshot.iso_week_key, 202601);
assert_eq!(snapshot.week_start_date_key, date_key("2025-12-29"));
assert_eq!(snapshot.week_end_date_key, date_key("2026-01-04"));
assert_eq!(snapshot.month_key, 202512);
assert_eq!(snapshot.quarter_key, 20254);
assert_eq!(snapshot.year_key, 2025);
}
#[test]
fn analytics_date_dimension_handles_new_year_inside_iso_week() {
// 中文注释2026-01-01 仍落在 2026-W01周范围跨自然年。
let snapshot = dimension("2026-01-01");
assert_eq!(snapshot.calendar_date, "2026-01-01");
assert_eq!(snapshot.weekday, 4);
assert_eq!(snapshot.iso_week_key, 202601);
assert_eq!(snapshot.week_start_date_key, date_key("2025-12-29"));
assert_eq!(snapshot.week_end_date_key, date_key("2026-01-04"));
assert_eq!(snapshot.month_key, 202601);
assert_eq!(snapshot.month_start_date_key, date_key("2026-01-01"));
assert_eq!(snapshot.month_end_date_key, date_key("2026-01-31"));
assert_eq!(snapshot.quarter_key, 20261);
assert_eq!(snapshot.year_key, 2026);
}
#[test]
fn analytics_date_dimension_handles_q1_end() {
// 中文注释Q1 结束日应映射到 2026Q1季度边界为 1 月 1 日到 3 月 31 日。
let snapshot = dimension("2026-03-31");
assert_eq!(snapshot.calendar_date, "2026-03-31");
assert_eq!(snapshot.weekday, 2);
assert_eq!(snapshot.iso_week_key, 202614);
assert_eq!(snapshot.month_key, 202603);
assert_eq!(snapshot.month_start_date_key, date_key("2026-03-01"));
assert_eq!(snapshot.month_end_date_key, date_key("2026-03-31"));
assert_eq!(snapshot.quarter_key, 20261);
assert_eq!(snapshot.quarter_start_date_key, date_key("2026-01-01"));
assert_eq!(snapshot.quarter_end_date_key, date_key("2026-03-31"));
assert_eq!(snapshot.year_key, 2026);
}
#[test]
fn analytics_date_dimension_handles_q2_start() {
// 中文注释Q2 开始日应映射到 2026Q2季度边界为 4 月 1 日到 6 月 30 日。
let snapshot = dimension("2026-04-01");
assert_eq!(snapshot.calendar_date, "2026-04-01");
assert_eq!(snapshot.weekday, 3);
assert_eq!(snapshot.iso_week_key, 202614);
assert_eq!(snapshot.month_key, 202604);
assert_eq!(snapshot.month_start_date_key, date_key("2026-04-01"));
assert_eq!(snapshot.month_end_date_key, date_key("2026-04-30"));
assert_eq!(snapshot.quarter_key, 20262);
assert_eq!(snapshot.quarter_start_date_key, date_key("2026-04-01"));
assert_eq!(snapshot.quarter_end_date_key, date_key("2026-06-30"));
assert_eq!(snapshot.year_key, 2026);
}
#[test]
fn analytics_date_dimension_handles_year_end() {
// 中文注释2026 年末属于 2026-W53且所有自然年边界应保持在 2026 年内。
let snapshot = dimension("2026-12-31");
assert_eq!(snapshot.calendar_date, "2026-12-31");
assert_eq!(snapshot.weekday, 4);
assert_eq!(snapshot.iso_week_key, 202653);
assert_eq!(snapshot.week_start_date_key, date_key("2026-12-28"));
assert_eq!(snapshot.week_end_date_key, date_key("2027-01-03"));
assert_eq!(snapshot.month_key, 202612);
assert_eq!(snapshot.month_start_date_key, date_key("2026-12-01"));
assert_eq!(snapshot.month_end_date_key, date_key("2026-12-31"));
assert_eq!(snapshot.quarter_key, 20264);
assert_eq!(snapshot.quarter_start_date_key, date_key("2026-10-01"));
assert_eq!(snapshot.quarter_end_date_key, date_key("2026-12-31"));
assert_eq!(snapshot.year_key, 2026);
assert_eq!(snapshot.year_start_date_key, date_key("2026-01-01"));
assert_eq!(snapshot.year_end_date_key, date_key("2026-12-31"));
}
#[test]
fn analytics_date_key_parser_rejects_invalid_calendar_dates() {
// 中文注释:非法日期和非 YYYY-MM-DD 字符串都必须解析失败,避免写入脏维表。
assert_eq!(
parse_analytics_calendar_date_key("2026-02-30"),
Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)
);
assert_eq!(
parse_analytics_calendar_date_key("bad"),
Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)
);
}
#[test]
fn analytics_date_dimension_rejects_out_of_supported_range() {
// 中文注释:维表只允许受控业务日期范围,避免裸 date_key 极值进入 reducer 日历算法。
assert_eq!(
parse_analytics_calendar_date_key("1999-12-31"),
Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)
);
assert_eq!(
parse_analytics_calendar_date_key("2101-01-01"),
Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)
);
assert_eq!(
validate_analytics_date_dimension_date_key(i64::MAX),
Err(RuntimeProfileFieldError::InvalidAnalyticsCalendarDate)
);
}

View File

@@ -0,0 +1,105 @@
use module_runtime::{
AnalyticsGranularity, RuntimeAnalyticsDailyStatSnapshot, RuntimeTrackingScopeKind,
aggregate_runtime_tracking_daily_stats,
};
fn stat(event_key: &str, scope_id: &str, day_key: i64, count: u32) -> RuntimeAnalyticsDailyStatSnapshot {
RuntimeAnalyticsDailyStatSnapshot {
event_key: event_key.to_string(),
scope_kind: RuntimeTrackingScopeKind::User,
scope_id: scope_id.to_string(),
day_key,
count,
}
}
#[test]
fn aggregates_daily_stats_by_iso_week_bucket() {
let buckets = aggregate_runtime_tracking_daily_stats(
vec![
stat("daily_login", "user-1", 20_517, 1), // 2026-03-05
stat("daily_login", "user-1", 20_518, 2), // 2026-03-06
stat("daily_login", "user-1", 20_524, 3), // 2026-03-12
stat("daily_login", "user-2", 20_517, 9),
],
"daily_login",
RuntimeTrackingScopeKind::User,
"user-1",
AnalyticsGranularity::Week,
);
assert_eq!(buckets.len(), 2);
assert_eq!(buckets[0].bucket_key, "202610");
assert_eq!(buckets[0].bucket_start_date_key, 20_514); // 2026-03-02
assert_eq!(buckets[0].bucket_end_date_key, 20_520); // 2026-03-08
assert_eq!(buckets[0].value, 3);
assert_eq!(buckets[1].bucket_key, "202611");
assert_eq!(buckets[1].bucket_start_date_key, 20_521); // 2026-03-09
assert_eq!(buckets[1].bucket_end_date_key, 20_527); // 2026-03-15
assert_eq!(buckets[1].value, 3);
}
#[test]
fn aggregates_daily_stats_by_month_quarter_and_year_bucket() {
let stats = vec![
stat("play", "user-1", 20_545, 2), // 2026-04-02
stat("play", "user-1", 20_573, 3), // 2026-04-30
stat("play", "user-1", 20_574, 5), // 2026-05-01
stat("play", "user-1", 20_818, 7), // 2026-12-31
];
let month = aggregate_runtime_tracking_daily_stats(
stats.clone(),
"play",
RuntimeTrackingScopeKind::User,
"user-1",
AnalyticsGranularity::Month,
);
assert_eq!(month.iter().map(|bucket| (&bucket.bucket_key, bucket.value)).collect::<Vec<_>>(), vec![(&"202604".to_string(), 5), (&"202605".to_string(), 5), (&"202612".to_string(), 7)]);
assert_eq!(month[0].bucket_start_date_key, 20_544);
assert_eq!(month[0].bucket_end_date_key, 20_573);
let quarter = aggregate_runtime_tracking_daily_stats(
stats.clone(),
"play",
RuntimeTrackingScopeKind::User,
"user-1",
AnalyticsGranularity::Quarter,
);
assert_eq!(quarter.iter().map(|bucket| (&bucket.bucket_key, bucket.value)).collect::<Vec<_>>(), vec![(&"20262".to_string(), 10), (&"20264".to_string(), 7)]);
let year = aggregate_runtime_tracking_daily_stats(
stats,
"play",
RuntimeTrackingScopeKind::User,
"user-1",
AnalyticsGranularity::Year,
);
assert_eq!(year.len(), 1);
assert_eq!(year[0].bucket_key, "2026");
assert_eq!(year[0].value, 17);
}
#[test]
fn day_granularity_keeps_each_day_bucket_and_filters_scope() {
let buckets = aggregate_runtime_tracking_daily_stats(
vec![
stat("daily_login", "user-1", 20_517, 1),
stat("daily_login", "user-1", 20_518, 2),
stat("daily_login", "user-2", 20_517, 9),
stat("other", "user-1", 20_517, 9),
],
"daily_login",
RuntimeTrackingScopeKind::User,
"user-1",
AnalyticsGranularity::Day,
);
assert_eq!(buckets.len(), 2);
assert_eq!(buckets[0].bucket_key, "2026-03-05");
assert_eq!(buckets[0].bucket_start_date_key, 20_517);
assert_eq!(buckets[0].bucket_end_date_key, 20_517);
assert_eq!(buckets[0].value, 1);
assert_eq!(buckets[1].bucket_key, "2026-03-06");
assert_eq!(buckets[1].value, 2);
}

View File

@@ -0,0 +1,60 @@
use module_runtime::{
RuntimeProfileFieldError, RuntimeProfileInviteCodeSnapshot, RuntimeProfileInviteCodeStatus,
build_runtime_profile_invite_code_record, resolve_runtime_profile_invite_code_status,
validate_runtime_profile_invite_code_validity_window,
};
#[test]
fn invite_code_validity_window_rejects_start_after_expire() {
let result = validate_runtime_profile_invite_code_validity_window(Some(20), Some(10));
assert_eq!(
result,
Err(RuntimeProfileFieldError::InvalidInviteCodeValidityWindow)
);
}
#[test]
fn invite_code_validity_window_allows_open_ended_or_equal_boundary() {
assert!(validate_runtime_profile_invite_code_validity_window(None, None).is_ok());
assert!(validate_runtime_profile_invite_code_validity_window(Some(10), None).is_ok());
assert!(validate_runtime_profile_invite_code_validity_window(None, Some(10)).is_ok());
assert!(validate_runtime_profile_invite_code_validity_window(Some(10), Some(10)).is_ok());
}
#[test]
fn invite_code_status_uses_inclusive_start_and_exclusive_expire_boundary() {
assert_eq!(
resolve_runtime_profile_invite_code_status(Some(20), None, 19),
RuntimeProfileInviteCodeStatus::Pending
);
assert_eq!(
resolve_runtime_profile_invite_code_status(Some(20), Some(30), 20),
RuntimeProfileInviteCodeStatus::Active
);
assert_eq!(
resolve_runtime_profile_invite_code_status(Some(20), Some(30), 29),
RuntimeProfileInviteCodeStatus::Active
);
assert_eq!(
resolve_runtime_profile_invite_code_status(Some(20), Some(30), 30),
RuntimeProfileInviteCodeStatus::Expired
);
}
#[test]
fn invite_code_record_formats_window_and_status() {
let record = build_runtime_profile_invite_code_record(RuntimeProfileInviteCodeSnapshot {
user_id: "user-1".to_string(),
invite_code: "SY00000001".to_string(),
metadata_json: "{}".to_string(),
starts_at_micros: Some(0),
expires_at_micros: Some(1_000_000),
created_at_micros: 0,
updated_at_micros: 1_000_000,
});
assert_eq!(record.starts_at.as_deref(), Some("1970-01-01T00:00:00Z"));
assert_eq!(record.expires_at.as_deref(), Some("1970-01-01T00:00:01Z"));
assert_eq!(record.status, RuntimeProfileInviteCodeStatus::Expired);
}

View File

@@ -0,0 +1,83 @@
use module_runtime::{
RuntimeProfileFieldError, RuntimeProfileTaskCycle, RuntimeTrackingScopeKind,
build_runtime_profile_task_config_admin_upsert_input, build_runtime_tracking_daily_stat_id,
};
fn build_task_scope_input(
scope_kind: RuntimeTrackingScopeKind,
) -> Result<module_runtime::RuntimeProfileTaskConfigAdminUpsertInput, RuntimeProfileFieldError> {
build_runtime_profile_task_config_admin_upsert_input(
"admin-1".to_string(),
"daily-login".to_string(),
"每日登录".to_string(),
"".to_string(),
"daily_login".to_string(),
RuntimeProfileTaskCycle::Daily,
scope_kind,
1,
10,
true,
10,
1_000,
)
}
#[test]
fn admin_upsert_build_input_accepts_user_scope() {
let input = build_task_scope_input(RuntimeTrackingScopeKind::User)
.expect("个人任务 user scope 应允许保存");
assert_eq!(input.scope_kind, RuntimeTrackingScopeKind::User);
}
#[test]
fn admin_upsert_build_input_rejects_non_user_scope_with_clear_message() {
for scope_kind in [
RuntimeTrackingScopeKind::Site,
RuntimeTrackingScopeKind::Module,
RuntimeTrackingScopeKind::Work,
] {
let error = build_task_scope_input(scope_kind).expect_err("非 user scope 应拒绝保存");
assert_eq!(
error,
RuntimeProfileFieldError::UnsupportedProfileTaskScopeKind
);
assert!(
error.to_string().contains("仅支持 user"),
"错误信息应明确说明个人任务仅支持 user实际为{}",
error
);
}
}
#[test]
fn tracking_daily_stat_id_keeps_work_scope_separate_from_user_scope() {
let user_id = "user-1";
let work_id = "work-1";
let day_key = 20_000;
let user_stat_id = build_runtime_tracking_daily_stat_id(
"daily_login",
RuntimeTrackingScopeKind::User,
user_id,
day_key,
);
let work_stat_id = build_runtime_tracking_daily_stat_id(
"daily_login",
RuntimeTrackingScopeKind::Work,
work_id,
day_key,
);
let invalid_work_with_user_id_stat_id = build_runtime_tracking_daily_stat_id(
"daily_login",
RuntimeTrackingScopeKind::Work,
user_id,
day_key,
);
// 中文注释Work 维度必须保留独立 scope_kind不允许被静默当作 user_id 查询用户桶。
assert!(user_stat_id.contains(":user:user-1:"));
assert!(work_stat_id.contains(":work:work-1:"));
assert_ne!(user_stat_id, invalid_work_with_user_id_stat_id);
}

View File

@@ -0,0 +1,14 @@
[package]
name = "module-square-hole"
edition.workspace = true
version.workspace = true
license.workspace = true
[features]
default = []
spacetime-types = ["dep:spacetimedb"]
[dependencies]
serde = { version = "1", features = ["derive"] }
shared-kernel = { path = "../shared-kernel" }
spacetimedb = { workspace = true, optional = true }

View File

@@ -0,0 +1,456 @@
use shared_kernel::{normalize_optional_string, normalize_required_string, normalize_string_list};
use crate::commands::{default_tags_for_theme, validate_publish_requirements};
use crate::{
SQUARE_HOLE_DEFAULT_DURATION_LIMIT_MS, SQUARE_HOLE_MAX_DIFFICULTY, SQUARE_HOLE_MIN_DIFFICULTY,
SquareHoleCreatorConfig, SquareHoleDropConfirmation, SquareHoleDropFeedback,
SquareHoleDropInput, SquareHoleDropRejectReason, SquareHoleError, SquareHoleHoleSnapshot,
SquareHolePublicationStatus, SquareHoleResultDraft, SquareHoleRunSnapshot, SquareHoleRunStatus,
SquareHoleShapeSnapshot, SquareHoleWorkProfile,
};
pub fn compile_result_draft(
profile_id: String,
config: &SquareHoleCreatorConfig,
) -> SquareHoleResultDraft {
let game_name = format!("{}方洞挑战", config.theme_text);
let summary = format!(
"{}主题,{} 个形状,难度 {},真实规则:{}",
config.theme_text, config.shape_count, config.difficulty, config.twist_rule
);
let mut draft = SquareHoleResultDraft {
profile_id,
game_name,
theme_text: config.theme_text.clone(),
twist_rule: config.twist_rule.clone(),
summary,
tags: default_tags_for_theme(&config.theme_text),
shape_count: config.shape_count,
difficulty: config.difficulty,
publish_ready: false,
blockers: Vec::new(),
};
draft.blockers = validate_publish_requirements(&draft);
draft.publish_ready = draft.blockers.is_empty();
draft
}
pub fn create_work_profile(
work_id: String,
profile_id: String,
owner_user_id: String,
source_session_id: Option<String>,
draft: &SquareHoleResultDraft,
updated_at_micros: i64,
) -> Result<SquareHoleWorkProfile, SquareHoleError> {
let work_id = normalize_required_string(work_id).ok_or(SquareHoleError::MissingText)?;
let profile_id =
normalize_required_string(profile_id).ok_or(SquareHoleError::MissingProfileId)?;
let owner_user_id =
normalize_required_string(owner_user_id).ok_or(SquareHoleError::MissingOwnerUserId)?;
Ok(SquareHoleWorkProfile {
work_id,
profile_id,
owner_user_id,
source_session_id: normalize_optional_string(source_session_id),
game_name: draft.game_name.clone(),
theme_text: draft.theme_text.clone(),
twist_rule: draft.twist_rule.clone(),
summary: draft.summary.clone(),
tags: normalize_string_list(draft.tags.clone()),
cover_image_src: None,
shape_count: draft.shape_count,
difficulty: draft.difficulty,
publication_status: SquareHolePublicationStatus::Draft,
play_count: 0,
updated_at_micros,
published_at_micros: None,
})
}
pub fn publish_work_profile(
profile: &SquareHoleWorkProfile,
published_at_micros: i64,
) -> Result<SquareHoleWorkProfile, SquareHoleError> {
if profile.shape_count == 0 {
return Err(SquareHoleError::InvalidShapeCount);
}
if !(SQUARE_HOLE_MIN_DIFFICULTY..=SQUARE_HOLE_MAX_DIFFICULTY).contains(&profile.difficulty) {
return Err(SquareHoleError::InvalidDifficulty);
}
let mut next = profile.clone();
next.publication_status = SquareHolePublicationStatus::Published;
next.updated_at_micros = published_at_micros;
next.published_at_micros = Some(published_at_micros);
Ok(next)
}
pub fn start_run_at(
run_id: String,
owner_user_id: String,
profile_id: String,
config: &SquareHoleCreatorConfig,
started_at_ms: u64,
) -> Result<SquareHoleRunSnapshot, SquareHoleError> {
let run_id = normalize_required_string(run_id).ok_or(SquareHoleError::MissingRunId)?;
let owner_user_id =
normalize_required_string(owner_user_id).ok_or(SquareHoleError::MissingOwnerUserId)?;
let profile_id =
normalize_required_string(profile_id).ok_or(SquareHoleError::MissingProfileId)?;
Ok(SquareHoleRunSnapshot {
run_id,
profile_id,
owner_user_id,
status: SquareHoleRunStatus::Running,
snapshot_version: 1,
started_at_ms,
duration_limit_ms: SQUARE_HOLE_DEFAULT_DURATION_LIMIT_MS,
remaining_ms: SQUARE_HOLE_DEFAULT_DURATION_LIMIT_MS,
total_shape_count: config.shape_count,
completed_shape_count: 0,
combo: 0,
best_combo: 0,
score: 0,
rule_label: config.twist_rule.clone(),
current_shape: Some(build_shape_at(0, config.shape_count)),
holes: default_holes(),
last_feedback: None,
})
}
pub fn confirm_drop_at(
run: &SquareHoleRunSnapshot,
input: &SquareHoleDropInput,
) -> Result<SquareHoleDropConfirmation, SquareHoleError> {
let hole_id =
normalize_required_string(&input.hole_id).ok_or(SquareHoleError::MissingHoleId)?;
let mut next = resolve_run_timer_at(run, input.dropped_at_ms);
if next.status != SquareHoleRunStatus::Running {
return Ok(rejected(next, SquareHoleDropRejectReason::RunNotActive));
}
if input.client_snapshot_version != next.snapshot_version {
return Ok(rejected(
next,
SquareHoleDropRejectReason::SnapshotVersionMismatch,
));
}
let Some(hole) = next.holes.iter().find(|item| item.hole_id == hole_id) else {
return Ok(rejected(next, SquareHoleDropRejectReason::HoleNotFound));
};
let Some(shape) = next.current_shape.clone() else {
return Ok(rejected(next, SquareHoleDropRejectReason::Incompatible));
};
if !is_shape_accepted_by_hole(&shape, hole) {
next.combo = 0;
next.snapshot_version = next.snapshot_version.saturating_add(1);
return Ok(rejected(next, SquareHoleDropRejectReason::Incompatible));
}
let message = format!("{}进入{}", shape.label, hole.label);
let feedback = SquareHoleDropFeedback {
accepted: true,
reject_reason: None,
message,
};
next.completed_shape_count = next.completed_shape_count.saturating_add(1);
next.combo = next.combo.saturating_add(1);
next.best_combo = next.best_combo.max(next.combo);
next.score = next.score.saturating_add(100 + next.combo * 10);
next.current_shape = if next.completed_shape_count >= next.total_shape_count {
next.status = SquareHoleRunStatus::Won;
None
} else {
Some(build_shape_at(
next.completed_shape_count,
next.total_shape_count,
))
};
next.snapshot_version = next.snapshot_version.saturating_add(1);
next.last_feedback = Some(feedback.clone());
Ok(SquareHoleDropConfirmation {
feedback,
run: next,
})
}
pub fn resolve_run_timer_at(run: &SquareHoleRunSnapshot, now_ms: u64) -> SquareHoleRunSnapshot {
let mut next = run.clone();
if next.status != SquareHoleRunStatus::Running {
return next;
}
let elapsed_ms = now_ms.saturating_sub(next.started_at_ms);
next.remaining_ms = next.duration_limit_ms.saturating_sub(elapsed_ms);
if next.remaining_ms == 0 {
let feedback = SquareHoleDropFeedback {
accepted: false,
reject_reason: Some(SquareHoleDropRejectReason::TimeUp),
message: "时间到".to_string(),
};
next.status = SquareHoleRunStatus::Failed;
next.combo = 0;
next.current_shape = None;
next.last_feedback = Some(feedback);
next.snapshot_version = next.snapshot_version.saturating_add(1);
}
next
}
pub fn stop_run_at(run: &SquareHoleRunSnapshot) -> SquareHoleRunSnapshot {
let mut next = run.clone();
if next.status == SquareHoleRunStatus::Running {
next.status = SquareHoleRunStatus::Stopped;
next.combo = 0;
next.snapshot_version = next.snapshot_version.saturating_add(1);
next.last_feedback = Some(SquareHoleDropFeedback {
accepted: false,
reject_reason: Some(SquareHoleDropRejectReason::RunNotActive),
message: "已退出本局".to_string(),
});
}
next
}
pub fn build_shape_at(index: u32, total: u32) -> SquareHoleShapeSnapshot {
let kind = if index + 1 == total {
"square"
} else if index % 4 == 0 {
"circle"
} else if index % 4 == 1 {
"triangle"
} else if index % 4 == 2 {
"diamond"
} else {
"star"
};
SquareHoleShapeSnapshot {
shape_id: format!("square-hole-shape-{index:03}"),
shape_kind: kind.to_string(),
label: match kind {
"square" => "方块",
"circle" => "圆块",
"triangle" => "三角块",
"diamond" => "菱形块",
_ => "星形块",
}
.to_string(),
color: match kind {
"square" => "#facc15",
"circle" => "#22c55e",
"triangle" => "#38bdf8",
"diamond" => "#fb7185",
_ => "#c084fc",
}
.to_string(),
}
}
pub fn default_holes() -> Vec<SquareHoleHoleSnapshot> {
vec![
SquareHoleHoleSnapshot {
hole_id: "square-hole".to_string(),
hole_kind: "square".to_string(),
label: "方洞".to_string(),
x: 0.5,
y: 0.28,
},
SquareHoleHoleSnapshot {
hole_id: "circle-hole".to_string(),
hole_kind: "circle".to_string(),
label: "圆洞".to_string(),
x: 0.24,
y: 0.54,
},
SquareHoleHoleSnapshot {
hole_id: "triangle-hole".to_string(),
hole_kind: "triangle".to_string(),
label: "三角洞".to_string(),
x: 0.76,
y: 0.54,
},
]
}
fn is_shape_accepted_by_hole(
shape: &SquareHoleShapeSnapshot,
hole: &SquareHoleHoleSnapshot,
) -> bool {
// 中文注释:首版核心反差固定为“方洞万能”,保留同形状洞口兼容便于后续扩展规则。
hole.hole_kind == "square" || hole.hole_kind == shape.shape_kind
}
fn rejected(
mut run: SquareHoleRunSnapshot,
reject_reason: SquareHoleDropRejectReason,
) -> SquareHoleDropConfirmation {
let message = match reject_reason {
SquareHoleDropRejectReason::RunNotActive => "当前局已结束",
SquareHoleDropRejectReason::SnapshotVersionMismatch => "操作慢了一步",
SquareHoleDropRejectReason::HoleNotFound => "洞口不存在",
SquareHoleDropRejectReason::Incompatible => "这个洞不对",
SquareHoleDropRejectReason::TimeUp => "时间到",
}
.to_string();
let feedback = SquareHoleDropFeedback {
accepted: false,
reject_reason: Some(reject_reason),
message,
};
run.last_feedback = Some(feedback.clone());
SquareHoleDropConfirmation { feedback, run }
}
#[cfg(test)]
mod tests {
use super::*;
use crate::commands::build_creator_config;
fn test_config(shape_count: u32) -> SquareHoleCreatorConfig {
build_creator_config("玩具", "方洞万能", shape_count, 4).expect("config should be valid")
}
#[test]
fn draft_is_publishable_with_required_fields() {
let draft = compile_result_draft("profile-1".to_string(), &test_config(8));
assert!(draft.publish_ready);
assert!(draft.blockers.is_empty());
assert!(draft.tags.contains(&"方洞挑战".to_string()));
}
#[test]
fn run_starts_with_current_shape_and_default_holes() {
let run = start_run_at(
"run-1".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(8),
1_000,
)
.expect("run should start");
assert_eq!(run.status, SquareHoleRunStatus::Running);
assert!(run.current_shape.is_some());
assert_eq!(run.holes.len(), 3);
}
#[test]
fn square_hole_accepts_non_square_shape() {
let run = start_run_at(
"run-1".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(8),
1_000,
)
.expect("run should start");
let result = confirm_drop_at(
&run,
&SquareHoleDropInput {
run_id: run.run_id.clone(),
owner_user_id: run.owner_user_id.clone(),
hole_id: "square-hole".to_string(),
client_snapshot_version: run.snapshot_version,
client_event_id: "event-1".to_string(),
dropped_at_ms: 1_100,
},
)
.expect("drop should resolve");
assert!(result.feedback.accepted);
assert_eq!(result.run.completed_shape_count, 1);
assert_eq!(result.run.combo, 1);
}
#[test]
fn wrong_non_square_hole_rejects_and_resets_combo() {
let mut run = start_run_at(
"run-1".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(8),
1_000,
)
.expect("run should start");
run.current_shape = Some(build_shape_at(1, 8));
run.combo = 2;
let result = confirm_drop_at(
&run,
&SquareHoleDropInput {
run_id: run.run_id.clone(),
owner_user_id: run.owner_user_id.clone(),
hole_id: "circle-hole".to_string(),
client_snapshot_version: run.snapshot_version,
client_event_id: "event-1".to_string(),
dropped_at_ms: 1_100,
},
)
.expect("drop should resolve");
assert!(!result.feedback.accepted);
assert_eq!(
result.feedback.reject_reason,
Some(SquareHoleDropRejectReason::Incompatible)
);
assert_eq!(result.run.combo, 0);
}
#[test]
fn last_shape_win_finishes_run() {
let mut run = start_run_at(
"run-1".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(6),
1_000,
)
.expect("run should start");
run.completed_shape_count = 5;
run.current_shape = Some(build_shape_at(5, 6));
let result = confirm_drop_at(
&run,
&SquareHoleDropInput {
run_id: run.run_id.clone(),
owner_user_id: run.owner_user_id.clone(),
hole_id: "square-hole".to_string(),
client_snapshot_version: run.snapshot_version,
client_event_id: "event-1".to_string(),
dropped_at_ms: 1_100,
},
)
.expect("drop should resolve");
assert_eq!(result.run.status, SquareHoleRunStatus::Won);
assert!(result.run.current_shape.is_none());
}
#[test]
fn timer_expiration_fails_running_run() {
let run = start_run_at(
"run-1".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(8),
1_000,
)
.expect("run should start");
let expired = resolve_run_timer_at(&run, 1_000 + SQUARE_HOLE_DEFAULT_DURATION_LIMIT_MS);
assert_eq!(expired.status, SquareHoleRunStatus::Failed);
assert_eq!(
expired
.last_feedback
.and_then(|feedback| feedback.reject_reason),
Some(SquareHoleDropRejectReason::TimeUp)
);
}
}

View File

@@ -0,0 +1,116 @@
use shared_kernel::{normalize_required_string, normalize_string_list};
use crate::{
SQUARE_HOLE_MAX_DIFFICULTY, SQUARE_HOLE_MAX_SHAPE_COUNT, SQUARE_HOLE_MIN_DIFFICULTY,
SQUARE_HOLE_MIN_SHAPE_COUNT, SquareHoleCreatorConfig, SquareHoleError, SquareHoleResultDraft,
};
pub fn validate_shape_count(value: u32) -> Result<u32, SquareHoleError> {
if (SQUARE_HOLE_MIN_SHAPE_COUNT..=SQUARE_HOLE_MAX_SHAPE_COUNT).contains(&value) {
Ok(value)
} else {
Err(SquareHoleError::InvalidShapeCount)
}
}
pub fn validate_difficulty(value: u32) -> Result<u32, SquareHoleError> {
if (SQUARE_HOLE_MIN_DIFFICULTY..=SQUARE_HOLE_MAX_DIFFICULTY).contains(&value) {
Ok(value)
} else {
Err(SquareHoleError::InvalidDifficulty)
}
}
pub fn normalize_theme_text(value: impl AsRef<str>) -> Result<String, SquareHoleError> {
normalize_required_string(value).ok_or(SquareHoleError::MissingText)
}
pub fn build_creator_config(
theme_text: &str,
twist_rule: &str,
shape_count: u32,
difficulty: u32,
) -> Result<SquareHoleCreatorConfig, SquareHoleError> {
Ok(SquareHoleCreatorConfig {
theme_text: normalize_theme_text(theme_text)?,
twist_rule: normalize_required_string(twist_rule).ok_or(SquareHoleError::MissingText)?,
shape_count: validate_shape_count(shape_count)?,
difficulty: validate_difficulty(difficulty)?,
})
}
pub fn build_default_tags(theme_text: &str) -> Vec<String> {
normalize_string_list(vec![
"方洞挑战".to_string(),
theme_text.to_string(),
"反直觉".to_string(),
])
}
pub fn default_tags_for_theme(theme_text: &str) -> Vec<String> {
let mut tags = vec![
"方洞挑战".to_string(),
"反直觉".to_string(),
theme_text.to_string(),
];
tags.sort();
tags.dedup();
tags
}
pub fn validate_publish_requirements(draft: &SquareHoleResultDraft) -> Vec<String> {
let mut blockers = Vec::new();
if normalize_required_string(&draft.game_name).is_none() {
blockers.push("游戏名称不能为空".to_string());
}
if normalize_required_string(&draft.summary).is_none() {
blockers.push("简介不能为空".to_string());
}
if normalize_required_string(&draft.theme_text).is_none() {
blockers.push("题材不能为空".to_string());
}
if normalize_required_string(&draft.twist_rule).is_none() {
blockers.push("反直觉规则不能为空".to_string());
}
if normalize_string_list(draft.tags.clone()).is_empty() {
blockers.push("至少需要 1 个标签".to_string());
}
if validate_shape_count(draft.shape_count).is_err() {
blockers.push(format!(
"形状数量必须在 {}{} 之间",
SQUARE_HOLE_MIN_SHAPE_COUNT, SQUARE_HOLE_MAX_SHAPE_COUNT
));
}
if validate_difficulty(draft.difficulty).is_err() {
blockers.push("难度必须在 1 到 10 之间".to_string());
}
blockers
}
#[deprecated(note = "请使用 compile_result_draft(profile_id, &config)")]
pub fn build_result_draft(
profile_id: String,
theme_text: String,
twist_rule: String,
shape_count: u32,
difficulty: u32,
) -> SquareHoleResultDraft {
let game_name = format!("{theme_text}方洞挑战");
let summary = format!(
"{theme_text}主题,{} 个形状,难度 {},规则:{twist_rule}",
shape_count, difficulty
);
let blockers = Vec::new();
SquareHoleResultDraft {
profile_id,
game_name,
theme_text,
twist_rule,
summary,
tags: build_default_tags("方洞挑战"),
shape_count,
difficulty,
publish_ready: true,
blockers,
}
}

View File

@@ -0,0 +1,204 @@
use serde::{Deserialize, Serialize};
#[cfg(feature = "spacetime-types")]
use spacetimedb::SpacetimeType;
pub const SQUARE_HOLE_SESSION_ID_PREFIX: &str = "square-hole-session-";
pub const SQUARE_HOLE_MESSAGE_ID_PREFIX: &str = "square-hole-message-";
pub const SQUARE_HOLE_PROFILE_ID_PREFIX: &str = "square-hole-profile-";
pub const SQUARE_HOLE_WORK_ID_PREFIX: &str = "square-hole-work-";
pub const SQUARE_HOLE_RUN_ID_PREFIX: &str = "square-hole-run-";
pub const SQUARE_HOLE_MIN_SHAPE_COUNT: u32 = 6;
pub const SQUARE_HOLE_MAX_SHAPE_COUNT: u32 = 24;
pub const SQUARE_HOLE_MIN_DIFFICULTY: u32 = 1;
pub const SQUARE_HOLE_MAX_DIFFICULTY: u32 = 10;
pub const SQUARE_HOLE_DEFAULT_DURATION_LIMIT_MS: u64 = 60_000;
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum SquareHoleCreationStage {
CollectingConfig,
DraftReady,
ReadyToPublish,
Published,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum SquareHolePublicationStatus {
Draft,
Published,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum SquareHoleRunStatus {
Running,
Won,
Failed,
Stopped,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum SquareHoleDropRejectReason {
RunNotActive,
SnapshotVersionMismatch,
HoleNotFound,
Incompatible,
TimeUp,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleCreatorConfig {
pub theme_text: String,
pub twist_rule: String,
pub shape_count: u32,
pub difficulty: u32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleResultDraft {
pub profile_id: String,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publish_ready: bool,
pub blockers: Vec<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleWorkProfile {
pub work_id: String,
pub profile_id: String,
pub owner_user_id: String,
pub source_session_id: Option<String>,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
pub cover_image_src: Option<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publication_status: SquareHolePublicationStatus,
pub play_count: u32,
pub updated_at_micros: i64,
pub published_at_micros: Option<i64>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleShapeSnapshot {
pub shape_id: String,
pub shape_kind: String,
pub label: String,
pub color: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SquareHoleHoleSnapshot {
pub hole_id: String,
pub hole_kind: String,
pub label: String,
pub x: f32,
pub y: f32,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleDropFeedback {
pub accepted: bool,
pub reject_reason: Option<SquareHoleDropRejectReason>,
pub message: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SquareHoleRunSnapshot {
pub run_id: String,
pub profile_id: String,
pub owner_user_id: String,
pub status: SquareHoleRunStatus,
pub snapshot_version: u64,
pub started_at_ms: u64,
pub duration_limit_ms: u64,
pub remaining_ms: u64,
pub total_shape_count: u32,
pub completed_shape_count: u32,
pub combo: u32,
pub best_combo: u32,
pub score: u32,
pub rule_label: String,
pub current_shape: Option<SquareHoleShapeSnapshot>,
pub holes: Vec<SquareHoleHoleSnapshot>,
pub last_feedback: Option<SquareHoleDropFeedback>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SquareHoleDropInput {
pub run_id: String,
pub owner_user_id: String,
pub hole_id: String,
pub client_snapshot_version: u64,
pub client_event_id: String,
pub dropped_at_ms: u64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SquareHoleDropConfirmation {
pub feedback: SquareHoleDropFeedback,
pub run: SquareHoleRunSnapshot,
}
impl SquareHoleCreationStage {
pub fn as_str(self) -> &'static str {
match self {
Self::CollectingConfig => "collecting_config",
Self::DraftReady => "draft_ready",
Self::ReadyToPublish => "ready_to_publish",
Self::Published => "published",
}
}
}
impl SquareHolePublicationStatus {
pub fn as_str(self) -> &'static str {
match self {
Self::Draft => "draft",
Self::Published => "published",
}
}
}
impl SquareHoleRunStatus {
pub fn as_str(self) -> &'static str {
match self {
Self::Running => "running",
Self::Won => "won",
Self::Failed => "failed",
Self::Stopped => "stopped",
}
}
}
impl SquareHoleDropRejectReason {
pub fn as_str(self) -> &'static str {
match self {
Self::RunNotActive => "run_not_active",
Self::SnapshotVersionMismatch => "snapshot_version_mismatch",
Self::HoleNotFound => "hole_not_found",
Self::Incompatible => "incompatible",
Self::TimeUp => "time_up",
}
}
}

View File

@@ -0,0 +1,37 @@
use std::fmt::{self, Display};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SquareHoleError {
MissingText,
MissingOwnerUserId,
InvalidShapeCount,
InvalidDifficulty,
MissingProfileId,
MissingRunId,
MissingHoleId,
RunNotActive,
SnapshotVersionMismatch,
HoleNotFound,
Incompatible,
}
impl Display for SquareHoleError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let message = match self {
Self::MissingText => "文本不能为空",
Self::MissingOwnerUserId => "owner_user_id 缺失",
Self::InvalidShapeCount => "形状数量必须在 6 到 24 之间",
Self::InvalidDifficulty => "难度必须在 1 到 10 之间",
Self::MissingProfileId => "缺少 profileId",
Self::MissingRunId => "缺少 runId",
Self::MissingHoleId => "缺少 holeId",
Self::RunNotActive => "当前运行态未激活",
Self::SnapshotVersionMismatch => "快照版本不一致",
Self::HoleNotFound => "洞口不存在",
Self::Incompatible => "当前形状不能投入这个洞口",
};
write!(f, "{message}")
}
}
impl std::error::Error for SquareHoleError {}

View File

@@ -0,0 +1,25 @@
//! 方洞挑战领域事件。
//!
//! 事件只表达已经发生的领域事实,是否持久化、投影或通知前端由
//! SpacetimeDB adapter 与 BFF 编排层决定。
/// 方洞挑战领域事件。
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum SquareHoleDomainEvent {
DraftCompiled {
profile_id: String,
owner_user_id: String,
occurred_at_micros: i64,
},
WorkPublished {
profile_id: String,
owner_user_id: String,
occurred_at_micros: i64,
},
RunSettled {
run_id: String,
owner_user_id: String,
status: String,
occurred_at_micros: i64,
},
}

View File

@@ -0,0 +1,11 @@
mod application;
mod commands;
mod domain;
mod errors;
mod events;
pub use application::*;
pub use commands::*;
pub use domain::*;
pub use errors::*;
pub use events::*;

View File

@@ -16,4 +16,7 @@ pub mod puzzle_runtime;
pub mod puzzle_works;
pub mod runtime;
pub mod runtime_story;
pub mod square_hole_agent;
pub mod square_hole_runtime;
pub mod square_hole_works;
pub mod story;

View File

@@ -25,6 +25,11 @@ pub const TRACKING_SCOPE_KIND_SITE: &str = "site";
pub const TRACKING_SCOPE_KIND_WORK: &str = "work";
pub const TRACKING_SCOPE_KIND_MODULE: &str = "module";
pub const TRACKING_SCOPE_KIND_USER: &str = "user";
pub const ANALYTICS_GRANULARITY_DAY: &str = "day";
pub const ANALYTICS_GRANULARITY_WEEK: &str = "week";
pub const ANALYTICS_GRANULARITY_MONTH: &str = "month";
pub const ANALYTICS_GRANULARITY_QUARTER: &str = "quarter";
pub const ANALYTICS_GRANULARITY_YEAR: &str = "year";
pub const BROWSE_HISTORY_THEME_MODE_MARTIAL: &str = "martial";
pub const BROWSE_HISTORY_THEME_MODE_ARCANE: &str = "arcane";
pub const BROWSE_HISTORY_THEME_MODE_MACHINA: &str = "machina";
@@ -367,6 +372,30 @@ pub struct ProfileTaskConfigAdminListResponse {
pub entries: Vec<ProfileTaskConfigAdminResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AnalyticsMetricQueryRequest {
pub event_key: String,
pub scope_kind: String,
pub scope_id: String,
pub granularity: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AnalyticsBucketMetricResponse {
pub bucket_key: String,
pub bucket_start_date_key: i64,
pub bucket_end_date_key: i64,
pub value: u64,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AnalyticsMetricQueryResponse {
pub buckets: Vec<AnalyticsBucketMetricResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AdminUpsertProfileTaskConfigRequest {
@@ -412,6 +441,10 @@ pub struct AdminUpsertProfileInviteCodeRequest {
pub invite_code: String,
#[serde(default)]
pub metadata: Option<serde_json::Value>,
#[serde(default)]
pub starts_at: Option<String>,
#[serde(default)]
pub expires_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
@@ -447,6 +480,9 @@ pub struct ProfileInviteCodeAdminResponse {
pub user_id: String,
pub invite_code: String,
pub metadata: serde_json::Value,
pub starts_at: Option<String>,
pub expires_at: Option<String>,
pub status: String,
pub created_at: String,
pub updated_at: String,
}

View File

@@ -0,0 +1,122 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CreateSquareHoleSessionRequest {
#[serde(default)]
pub seed_text: Option<String>,
#[serde(default)]
pub theme_text: Option<String>,
#[serde(default)]
pub twist_rule: Option<String>,
#[serde(default)]
pub shape_count: Option<u32>,
#[serde(default)]
pub difficulty: Option<u32>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SendSquareHoleMessageRequest {
pub client_message_id: String,
pub text: String,
#[serde(default)]
pub quick_fill_requested: Option<bool>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ExecuteSquareHoleActionRequest {
pub action: String,
#[serde(default)]
pub game_name: Option<String>,
#[serde(default)]
pub summary: Option<String>,
#[serde(default)]
pub tags: Option<Vec<String>>,
#[serde(default)]
pub cover_image_src: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleAnchorItemResponse {
pub key: String,
pub label: String,
pub value: String,
pub status: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleAnchorPackResponse {
pub theme: SquareHoleAnchorItemResponse,
pub twist_rule: SquareHoleAnchorItemResponse,
pub shape_count: SquareHoleAnchorItemResponse,
pub difficulty: SquareHoleAnchorItemResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleCreatorConfigResponse {
pub theme_text: String,
pub twist_rule: String,
pub shape_count: u32,
pub difficulty: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleResultDraftResponse {
pub profile_id: String,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publish_ready: bool,
pub blockers: Vec<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleAgentMessageResponse {
pub id: String,
pub role: String,
pub kind: String,
pub text: String,
pub created_at: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleSessionSnapshotResponse {
pub session_id: String,
pub current_turn: u32,
pub progress_percent: u32,
pub stage: String,
pub anchor_pack: SquareHoleAnchorPackResponse,
pub config: SquareHoleCreatorConfigResponse,
#[serde(default)]
pub draft: Option<SquareHoleResultDraftResponse>,
pub messages: Vec<SquareHoleAgentMessageResponse>,
#[serde(default)]
pub last_assistant_reply: Option<String>,
#[serde(default)]
pub published_profile_id: Option<String>,
pub updated_at: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleSessionResponse {
pub session: SquareHoleSessionSnapshotResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleActionResponse {
pub session: SquareHoleSessionSnapshotResponse,
}

View File

@@ -0,0 +1,89 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct StartSquareHoleRunRequest {
pub profile_id: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct DropSquareHoleShapeRequest {
#[serde(default)]
pub run_id: Option<String>,
pub hole_id: String,
pub client_snapshot_version: u64,
pub client_event_id: String,
pub dropped_at_ms: u64,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct StopSquareHoleRunRequest {
pub client_action_id: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleShapeSnapshotResponse {
pub shape_id: String,
pub shape_kind: String,
pub label: String,
pub color: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleHoleSnapshotResponse {
pub hole_id: String,
pub hole_kind: String,
pub label: String,
pub x: f32,
pub y: f32,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleDropFeedbackResponse {
pub accepted: bool,
#[serde(default)]
pub reject_reason: Option<String>,
pub message: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleRunSnapshotResponse {
pub run_id: String,
pub profile_id: String,
pub owner_user_id: String,
pub status: String,
pub snapshot_version: u64,
pub started_at_ms: u64,
pub duration_limit_ms: u64,
pub remaining_ms: u64,
pub total_shape_count: u32,
pub completed_shape_count: u32,
pub combo: u32,
pub best_combo: u32,
pub score: u32,
pub rule_label: String,
#[serde(default)]
pub current_shape: Option<SquareHoleShapeSnapshotResponse>,
pub holes: Vec<SquareHoleHoleSnapshotResponse>,
#[serde(default)]
pub last_feedback: Option<SquareHoleDropFeedbackResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleRunResponse {
pub run: SquareHoleRunSnapshotResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleDropResponse {
pub feedback: SquareHoleDropFeedbackResponse,
pub run: SquareHoleRunSnapshotResponse,
}

View File

@@ -0,0 +1,66 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PutSquareHoleWorkRequest {
pub game_name: String,
#[serde(default)]
pub theme_text: Option<String>,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
#[serde(default)]
pub cover_image_src: Option<String>,
pub shape_count: u32,
pub difficulty: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleWorkSummaryResponse {
pub work_id: String,
pub profile_id: String,
pub owner_user_id: String,
#[serde(default)]
pub source_session_id: Option<String>,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
#[serde(default)]
pub cover_image_src: Option<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publication_status: String,
pub play_count: u32,
pub updated_at: String,
#[serde(default)]
pub published_at: Option<String>,
pub publish_ready: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleWorkProfileResponse {
#[serde(flatten)]
pub summary: SquareHoleWorkSummaryResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleWorksResponse {
pub items: Vec<SquareHoleWorkSummaryResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleWorkDetailResponse {
pub item: SquareHoleWorkProfileResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SquareHoleWorkMutationResponse {
pub item: SquareHoleWorkProfileResponse,
}

View File

@@ -0,0 +1,37 @@
use serde_json::json;
use shared_contracts::runtime::{
AdminUpsertProfileInviteCodeRequest, ProfileInviteCodeAdminResponse,
};
#[test]
fn admin_upsert_invite_code_request_accepts_optional_validity_window() {
let request: AdminUpsertProfileInviteCodeRequest = serde_json::from_value(json!({
"inviteCode": "SY00000001",
"metadata": { "note": "测试" },
"startsAt": "2026-05-04T00:00:00Z",
"expiresAt": null
}))
.expect("邀请码管理请求应接受 startsAt/expiresAt");
assert_eq!(request.starts_at.as_deref(), Some("2026-05-04T00:00:00Z"));
assert_eq!(request.expires_at, None);
}
#[test]
fn admin_invite_code_response_serializes_window_and_status_as_camel_case() {
let response = ProfileInviteCodeAdminResponse {
user_id: "user-1".to_string(),
invite_code: "SY00000001".to_string(),
metadata: json!({}),
starts_at: Some("2026-05-04T00:00:00Z".to_string()),
expires_at: None,
status: "active".to_string(),
created_at: "2026-05-04T00:00:00Z".to_string(),
updated_at: "2026-05-04T00:00:00Z".to_string(),
};
let value = serde_json::to_value(response).expect("邀请码管理响应应可序列化");
assert_eq!(value["startsAt"], json!("2026-05-04T00:00:00Z"));
assert_eq!(value["expiresAt"], json!(null));
assert_eq!(value["status"], json!("active"));
}

View File

@@ -0,0 +1,51 @@
use serde_json::json;
use shared_contracts::runtime::{
AdminUpsertProfileTaskConfigRequest, ProfileTaskConfigAdminResponse, TRACKING_SCOPE_KIND_USER,
};
#[test]
fn admin_upsert_profile_task_config_keeps_personal_task_scope_user() {
let request: AdminUpsertProfileTaskConfigRequest = serde_json::from_value(json!({
"taskId": "daily_login",
"title": "每日登录",
"description": "",
"eventKey": "daily_login",
"cycle": "daily",
"scopeKind": "user",
"threshold": 1,
"rewardPoints": 10,
"enabled": true,
"sortOrder": 10
}))
.expect("个人任务配置请求应接受 user scope");
assert_eq!(request.scope_kind, TRACKING_SCOPE_KIND_USER);
let value = serde_json::to_value(request).expect("个人任务配置请求应可序列化");
assert_eq!(value["scopeKind"], json!(TRACKING_SCOPE_KIND_USER));
}
#[test]
fn profile_task_config_admin_response_serializes_scope_kind_as_user() {
let response = ProfileTaskConfigAdminResponse {
task_id: "daily_login".to_string(),
title: "每日登录".to_string(),
description: "".to_string(),
event_key: "daily_login".to_string(),
cycle: "daily".to_string(),
scope_kind: TRACKING_SCOPE_KIND_USER.to_string(),
threshold: 1,
reward_points: 10,
enabled: true,
sort_order: 10,
created_by: "admin".to_string(),
created_at: "2026-05-04T00:00:00Z".to_string(),
updated_by: "admin".to_string(),
updated_at: "2026-05-04T00:00:00Z".to_string(),
};
let value = serde_json::to_value(response).expect("个人任务配置响应应可序列化");
assert_eq!(value["scopeKind"], json!(TRACKING_SCOPE_KIND_USER));
assert_eq!(value["taskId"], json!("daily_login"));
assert_eq!(value["rewardPoints"], json!(10));
}

View File

@@ -17,6 +17,7 @@ module-puzzle = { path = "../module-puzzle" }
module-runtime = { path = "../module-runtime" }
module-runtime-story = { path = "../module-runtime-story" }
module-runtime-item = { path = "../module-runtime-item" }
module-square-hole = { path = "../module-square-hole" }
module-story = { path = "../module-story" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View File

@@ -51,6 +51,15 @@ pub use mapper::{
PuzzleSelectCoverImageRecordInput, PuzzleWorkLikeReportRecordInput,
PuzzleWorkPointIncentiveClaimRecordInput, PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput,
PuzzleWorkUpsertRecordInput, ResolveCombatActionRecord, ResolveNpcBattleInteractionInput,
SquareHoleAgentMessageFinalizeRecordInput, SquareHoleAgentMessageRecord,
SquareHoleAgentMessageSubmitRecordInput, SquareHoleAgentSessionCreateRecordInput,
SquareHoleAgentSessionRecord, SquareHoleAnchorItemRecord, SquareHoleAnchorPackRecord,
SquareHoleCompileDraftRecordInput, SquareHoleCreatorConfigRecord,
SquareHoleDropConfirmationRecord, SquareHoleDropFeedbackRecord, SquareHoleHoleSnapshotRecord,
SquareHoleResultDraftRecord, SquareHoleRunDropRecordInput, SquareHoleRunRecord,
SquareHoleRunRestartRecordInput, SquareHoleRunStartRecordInput, SquareHoleRunStopRecordInput,
SquareHoleRunTimeUpRecordInput, SquareHoleShapeSnapshotRecord, SquareHoleWorkProfileRecord,
SquareHoleWorkUpdateRecordInput,
};
pub mod ai;
@@ -64,6 +73,7 @@ pub mod match3d;
pub mod npc;
pub mod puzzle;
pub mod runtime;
pub mod square_hole;
pub mod story;
pub mod story_runtime;
@@ -136,6 +146,7 @@ use module_puzzle::{
use module_runtime::{
RuntimeBrowseHistoryRecord, RuntimePlatformTheme as DomainRuntimePlatformTheme,
RuntimeProfileDashboardRecord, RuntimeProfileInviteCodeRecord, RuntimeProfilePlayStatsRecord,
AnalyticsMetricQueryResponse as DomainAnalyticsMetricQueryResponse,
RuntimeProfileRechargeCenterRecord, RuntimeProfileRechargeOrderRecord,
RuntimeProfileRedeemCodeMode as DomainRuntimeProfileRedeemCodeMode,
RuntimeProfileRedeemCodeRecord, RuntimeProfileRewardCodeRedeemRecord,
@@ -167,6 +178,7 @@ use module_runtime::{
build_runtime_profile_wallet_adjustment_input,
build_runtime_profile_wallet_ledger_entry_record,
build_runtime_profile_wallet_ledger_list_input, build_runtime_referral_invite_center_get_input,
build_analytics_metric_query_input,
build_runtime_referral_invite_center_record, build_runtime_referral_redeem_input,
build_runtime_referral_redeem_record, build_runtime_setting_get_input,
build_runtime_setting_record, build_runtime_setting_upsert_input,

View File

@@ -181,6 +181,17 @@ impl From<module_runtime::RuntimeProfileTaskCenterGetInput> for RuntimeProfileTa
}
}
impl From<module_runtime::AnalyticsMetricQueryInput> for AnalyticsMetricQueryInput {
fn from(input: module_runtime::AnalyticsMetricQueryInput) -> Self {
Self {
event_key: input.event_key,
scope_kind: map_runtime_tracking_scope_kind(input.scope_kind),
scope_id: input.scope_id,
granularity: map_analytics_granularity(input.granularity),
}
}
}
impl From<module_runtime::RuntimeProfileTaskClaimInput> for RuntimeProfileTaskClaimInput {
fn from(input: module_runtime::RuntimeProfileTaskClaimInput) -> Self {
Self {
@@ -281,6 +292,8 @@ impl From<module_runtime::RuntimeProfileInviteCodeAdminUpsertInput>
admin_user_id: input.admin_user_id,
invite_code: input.invite_code,
metadata_json: input.metadata_json,
starts_at_micros: input.starts_at_micros,
expires_at_micros: input.expires_at_micros,
updated_at_micros: input.updated_at_micros,
}
}
@@ -897,6 +910,22 @@ pub(crate) fn map_runtime_profile_task_center_procedure_result(
))
}
pub(crate) fn map_analytics_metric_query_procedure_result(
result: AnalyticsMetricQueryProcedureResult,
) -> Result<DomainAnalyticsMetricQueryResponse, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(DomainAnalyticsMetricQueryResponse {
buckets: result
.buckets
.into_iter()
.map(map_analytics_bucket_metric)
.collect(),
})
}
pub(crate) fn map_runtime_profile_task_claim_procedure_result(
result: RuntimeProfileTaskClaimProcedureResult,
) -> Result<RuntimeProfileTaskClaimRecord, SpacetimeClientError> {
@@ -1546,6 +1575,110 @@ pub(crate) fn map_match3d_click_item_procedure_result(
})
}
pub(crate) fn map_square_hole_agent_session_procedure_result(
result: SquareHoleAgentSessionProcedureResult,
) -> Result<SquareHoleAgentSessionRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let session_json = result
.session_json
.ok_or_else(|| SpacetimeClientError::missing_snapshot("square hole agent session 快照"))?;
let session =
serde_json::from_str::<SquareHoleAgentSessionJsonRecord>(&session_json).map_err(
|error| {
SpacetimeClientError::Runtime(format!(
"square hole session_json 非法: {error}"
))
},
)?;
Ok(map_square_hole_agent_session_snapshot(session))
}
pub(crate) fn map_square_hole_work_procedure_result(
result: SquareHoleWorkProcedureResult,
) -> Result<SquareHoleWorkProfileRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let work_json = result
.work_json
.ok_or_else(|| SpacetimeClientError::missing_snapshot("square hole work 快照"))?;
let work = serde_json::from_str::<SquareHoleWorkJsonRecord>(&work_json).map_err(|error| {
SpacetimeClientError::Runtime(format!("square hole work_json 非法: {error}"))
})?;
Ok(map_square_hole_work_snapshot(work))
}
pub(crate) fn map_square_hole_works_procedure_result(
result: SquareHoleWorksProcedureResult,
) -> Result<Vec<SquareHoleWorkProfileRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let items_json = result
.items_json
.ok_or_else(|| SpacetimeClientError::missing_snapshot("square hole works 快照"))?;
let items = serde_json::from_str::<Vec<SquareHoleWorkJsonRecord>>(&items_json).map_err(
|error| {
SpacetimeClientError::Runtime(format!("square hole works items_json 非法: {error}"))
},
)?;
Ok(items.into_iter().map(map_square_hole_work_snapshot).collect())
}
pub(crate) fn map_square_hole_run_procedure_result(
result: SquareHoleRunProcedureResult,
) -> Result<SquareHoleRunRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let run_json = result
.run_json
.ok_or_else(|| SpacetimeClientError::missing_snapshot("square hole run 快照"))?;
map_square_hole_run_json(run_json)
}
pub(crate) fn map_square_hole_drop_shape_procedure_result(
result: SquareHoleDropShapeProcedureResult,
) -> Result<SquareHoleDropConfirmationRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let run_json = result
.run_json
.ok_or_else(|| SpacetimeClientError::missing_snapshot("square hole drop run 快照"))?;
let feedback_json = result.feedback_json.ok_or_else(|| {
SpacetimeClientError::missing_snapshot("square hole drop feedback 快照")
})?;
let run = map_square_hole_run_json(run_json)?;
let feedback =
serde_json::from_str::<SquareHoleDropFeedbackJsonRecord>(&feedback_json).map_err(
|error| {
SpacetimeClientError::Runtime(format!(
"square hole feedback_json 非法: {error}"
))
},
)?;
Ok(SquareHoleDropConfirmationRecord {
status: result.status,
accepted: feedback.accepted,
reject_reason: feedback.reject_reason.clone(),
failure_reason: result.failure_reason,
feedback: map_square_hole_feedback_snapshot(feedback),
run,
})
}
pub(crate) fn map_story_session_procedure_result(
result: StorySessionProcedureResult,
) -> Result<StorySessionResultRecord, SpacetimeClientError> {
@@ -1749,6 +1882,17 @@ pub(crate) fn map_runtime_profile_dashboard_snapshot(
}
}
pub(crate) fn map_analytics_bucket_metric(
bucket: AnalyticsBucketMetric,
) -> module_runtime::AnalyticsBucketMetric {
module_runtime::AnalyticsBucketMetric {
bucket_key: bucket.bucket_key,
bucket_start_date_key: bucket.bucket_start_date_key,
bucket_end_date_key: bucket.bucket_end_date_key,
value: bucket.value,
}
}
pub(crate) fn map_runtime_profile_wallet_ledger_entry_snapshot(
snapshot: RuntimeProfileWalletLedgerEntrySnapshot,
) -> module_runtime::RuntimeProfileWalletLedgerEntrySnapshot {
@@ -1997,6 +2141,8 @@ pub(crate) fn map_runtime_profile_invite_code_snapshot(
user_id: snapshot.user_id,
invite_code: snapshot.invite_code,
metadata_json: snapshot.metadata_json,
starts_at_micros: snapshot.starts_at_micros,
expires_at_micros: snapshot.expires_at_micros,
created_at_micros: snapshot.created_at_micros,
updated_at_micros: snapshot.updated_at_micros,
}
@@ -2773,6 +2919,198 @@ fn build_match3d_anchor_item(key: &str, label: &str, value: &str) -> Match3DAnch
}
}
fn map_square_hole_agent_session_snapshot(
snapshot: SquareHoleAgentSessionJsonRecord,
) -> SquareHoleAgentSessionRecord {
let config = map_square_hole_creator_config(snapshot.config);
SquareHoleAgentSessionRecord {
session_id: snapshot.session_id,
current_turn: snapshot.current_turn,
progress_percent: snapshot.progress_percent,
stage: normalize_square_hole_stage(&snapshot.stage).to_string(),
anchor_pack: build_square_hole_anchor_pack(&config),
config,
draft: snapshot.draft.map(map_square_hole_result_draft),
messages: snapshot
.messages
.into_iter()
.map(map_square_hole_agent_message_snapshot)
.collect(),
last_assistant_reply: empty_string_to_none(snapshot.last_assistant_reply),
published_profile_id: snapshot.published_profile_id,
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
}
}
fn map_square_hole_creator_config(
snapshot: SquareHoleCreatorConfigJsonRecord,
) -> SquareHoleCreatorConfigRecord {
SquareHoleCreatorConfigRecord {
theme_text: snapshot.theme_text,
twist_rule: snapshot.twist_rule,
shape_count: snapshot.shape_count,
difficulty: snapshot.difficulty,
}
}
fn map_square_hole_result_draft(
snapshot: SquareHoleDraftJsonRecord,
) -> SquareHoleResultDraftRecord {
SquareHoleResultDraftRecord {
profile_id: snapshot.profile_id,
game_name: snapshot.game_name,
theme_text: snapshot.theme_text,
twist_rule: snapshot.twist_rule,
summary: snapshot.summary_text,
tags: snapshot.tags,
shape_count: snapshot.shape_count,
difficulty: snapshot.difficulty,
publish_ready: false,
blockers: Vec::new(),
}
}
fn map_square_hole_agent_message_snapshot(
snapshot: SquareHoleAgentMessageJsonRecord,
) -> SquareHoleAgentMessageRecord {
SquareHoleAgentMessageRecord {
id: snapshot.message_id,
role: snapshot.role,
kind: normalize_square_hole_message_kind(&snapshot.kind).to_string(),
text: snapshot.text,
created_at: format_timestamp_micros(snapshot.created_at_micros),
}
}
fn map_square_hole_work_snapshot(
snapshot: SquareHoleWorkJsonRecord,
) -> SquareHoleWorkProfileRecord {
SquareHoleWorkProfileRecord {
work_id: snapshot.work_id,
profile_id: snapshot.profile_id,
owner_user_id: snapshot.owner_user_id,
source_session_id: empty_string_to_none(snapshot.source_session_id),
author_display_name: snapshot.author_display_name,
game_name: snapshot.game_name,
theme_text: snapshot.theme_text,
twist_rule: snapshot.twist_rule,
summary: snapshot.summary_text,
tags: snapshot.tags,
cover_image_src: empty_string_to_none(snapshot.cover_image_src),
shape_count: snapshot.shape_count,
difficulty: snapshot.difficulty,
publication_status: normalize_square_hole_publication_status(&snapshot.publication_status)
.to_string(),
play_count: snapshot.play_count,
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
published_at: snapshot.published_at_micros.map(format_timestamp_micros),
publish_ready: snapshot.publish_ready,
}
}
fn map_square_hole_run_json(run_json: String) -> Result<SquareHoleRunRecord, SpacetimeClientError> {
let run = serde_json::from_str::<SquareHoleRunJsonRecord>(&run_json).map_err(|error| {
SpacetimeClientError::Runtime(format!("square hole run_json 非法: {error}"))
})?;
Ok(map_square_hole_run_snapshot(run))
}
fn map_square_hole_run_snapshot(snapshot: SquareHoleRunJsonRecord) -> SquareHoleRunRecord {
SquareHoleRunRecord {
run_id: snapshot.run_id,
profile_id: snapshot.profile_id,
owner_user_id: snapshot.owner_user_id,
status: normalize_square_hole_run_status(&snapshot.status).to_string(),
snapshot_version: snapshot.snapshot_version,
started_at_ms: i64_to_u64_ms(snapshot.started_at_ms),
duration_limit_ms: i64_to_u64_ms(snapshot.duration_limit_ms),
server_now_ms: Some(i64_to_u64_ms(snapshot.server_now_ms)),
remaining_ms: i64_to_u64_ms(snapshot.remaining_ms),
total_shape_count: snapshot.total_shape_count,
completed_shape_count: snapshot.completed_shape_count,
combo: snapshot.combo,
best_combo: snapshot.best_combo,
score: snapshot.score,
rule_label: snapshot.rule_label,
current_shape: snapshot.current_shape.map(map_square_hole_shape_snapshot),
holes: snapshot
.holes
.into_iter()
.map(map_square_hole_hole_snapshot)
.collect(),
last_feedback: snapshot
.last_feedback
.map(map_square_hole_feedback_snapshot),
last_confirmed_action_id: None,
}
}
fn map_square_hole_shape_snapshot(
snapshot: SquareHoleShapeJsonRecord,
) -> SquareHoleShapeSnapshotRecord {
SquareHoleShapeSnapshotRecord {
shape_id: snapshot.shape_id,
shape_kind: snapshot.shape_kind,
label: snapshot.label,
color: snapshot.color,
}
}
fn map_square_hole_hole_snapshot(
snapshot: SquareHoleHoleJsonRecord,
) -> SquareHoleHoleSnapshotRecord {
SquareHoleHoleSnapshotRecord {
hole_id: snapshot.hole_id,
hole_kind: snapshot.hole_kind,
label: snapshot.label,
x: snapshot.x,
y: snapshot.y,
}
}
fn map_square_hole_feedback_snapshot(
snapshot: SquareHoleDropFeedbackJsonRecord,
) -> SquareHoleDropFeedbackRecord {
SquareHoleDropFeedbackRecord {
accepted: snapshot.accepted,
reject_reason: snapshot
.reject_reason
.map(|value| normalize_square_hole_reject_reason(&value).to_string()),
message: snapshot.message,
}
}
fn build_square_hole_anchor_pack(
config: &SquareHoleCreatorConfigRecord,
) -> SquareHoleAnchorPackRecord {
let shape_count = config.shape_count.to_string();
let difficulty = config.difficulty.to_string();
SquareHoleAnchorPackRecord {
theme: build_square_hole_anchor_item("theme", "题材主题", config.theme_text.as_str()),
twist_rule: build_square_hole_anchor_item("twistRule", "反差规则", config.twist_rule.as_str()),
shape_count: build_square_hole_anchor_item("shapeCount", "形状数量", shape_count.as_str()),
difficulty: build_square_hole_anchor_item("difficulty", "难度", difficulty.as_str()),
}
}
fn build_square_hole_anchor_item(
key: &str,
label: &str,
value: &str,
) -> SquareHoleAnchorItemRecord {
SquareHoleAnchorItemRecord {
key: key.to_string(),
label: label.to_string(),
value: value.to_string(),
status: if value.trim().is_empty() {
"missing"
} else {
"confirmed"
}
.to_string(),
}
}
fn normalize_match3d_stage(value: &str) -> &str {
match value {
"Collecting" | "collecting" | "collecting_config" => "collecting_config",
@@ -2798,6 +3136,54 @@ fn normalize_match3d_message_kind(value: &str) -> &str {
}
}
fn normalize_square_hole_stage(value: &str) -> &str {
match value {
"Collecting" | "CollectingConfig" | "collecting" | "collecting_config" => {
"collecting_config"
}
"ReadyToCompile" | "ready_to_compile" => "ready_to_compile",
"DraftCompiled" | "DraftReady" | "draft_compiled" | "draft_ready" => "draft_ready",
"Published" | "published" => "published",
_ => value,
}
}
fn normalize_square_hole_publication_status(value: &str) -> &str {
match value {
"Draft" | "draft" => "draft",
"Published" | "published" => "published",
_ => value,
}
}
fn normalize_square_hole_run_status(value: &str) -> &str {
match value {
"Running" | "running" => "running",
"Won" | "won" => "won",
"Failed" | "failed" => "failed",
"Stopped" | "stopped" => "stopped",
_ => value,
}
}
fn normalize_square_hole_message_kind(value: &str) -> &str {
match value {
"text" => "chat",
_ => value,
}
}
fn normalize_square_hole_reject_reason(value: &str) -> &str {
match value {
"RunNotActive" | "run_not_active" => "run_not_active",
"SnapshotVersionMismatch" | "snapshot_version_mismatch" => "snapshot_version_mismatch",
"HoleNotFound" | "hole_not_found" => "hole_not_found",
"Incompatible" | "incompatible" => "incompatible",
"TimeUp" | "time_up" => "time_up",
_ => value,
}
}
fn empty_string_to_none(value: String) -> Option<String> {
let trimmed = value.trim();
if trimmed.is_empty() {
@@ -4008,6 +4394,18 @@ pub(crate) fn map_runtime_profile_wallet_ledger_source_type_back(
}
}
pub(crate) fn map_analytics_granularity(
granularity: module_runtime::AnalyticsGranularity,
) -> AnalyticsGranularity {
match granularity {
module_runtime::AnalyticsGranularity::Day => AnalyticsGranularity::Day,
module_runtime::AnalyticsGranularity::Week => AnalyticsGranularity::Week,
module_runtime::AnalyticsGranularity::Month => AnalyticsGranularity::Month,
module_runtime::AnalyticsGranularity::Quarter => AnalyticsGranularity::Quarter,
module_runtime::AnalyticsGranularity::Year => AnalyticsGranularity::Year,
}
}
pub(crate) fn map_runtime_tracking_scope_kind(
value: DomainRuntimeTrackingScopeKind,
) -> crate::module_bindings::RuntimeTrackingScopeKind {
@@ -5538,6 +5936,378 @@ struct Match3DRunJsonRecord {
failure_reason: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAgentSessionCreateRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub seed_text: String,
pub welcome_message_id: String,
pub welcome_message_text: String,
pub config_json: Option<String>,
pub created_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAgentMessageSubmitRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub user_message_id: String,
pub user_message_text: String,
pub submitted_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAgentMessageFinalizeRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub assistant_message_id: Option<String>,
pub assistant_reply_text: Option<String>,
pub config_json: Option<String>,
pub progress_percent: u32,
pub stage: String,
pub updated_at_micros: i64,
pub error_message: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleCompileDraftRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub profile_id: String,
pub author_display_name: String,
pub game_name: Option<String>,
pub summary_text: Option<String>,
pub tags_json: Option<String>,
pub cover_image_src: Option<String>,
pub compiled_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleWorkUpdateRecordInput {
pub profile_id: String,
pub owner_user_id: String,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary_text: String,
pub tags_json: String,
pub cover_image_src: String,
pub shape_count: u32,
pub difficulty: u32,
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleRunStartRecordInput {
pub run_id: String,
pub owner_user_id: String,
pub profile_id: String,
pub started_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleRunDropRecordInput {
pub run_id: String,
pub owner_user_id: String,
pub hole_id: String,
pub client_snapshot_version: u64,
pub client_event_id: String,
pub dropped_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleRunStopRecordInput {
pub run_id: String,
pub owner_user_id: String,
pub stopped_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleRunRestartRecordInput {
pub source_run_id: String,
pub next_run_id: String,
pub owner_user_id: String,
pub restarted_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleRunTimeUpRecordInput {
pub run_id: String,
pub owner_user_id: String,
pub finished_at_ms: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAnchorItemRecord {
pub key: String,
pub label: String,
pub value: String,
pub status: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAnchorPackRecord {
pub theme: SquareHoleAnchorItemRecord,
pub twist_rule: SquareHoleAnchorItemRecord,
pub shape_count: SquareHoleAnchorItemRecord,
pub difficulty: SquareHoleAnchorItemRecord,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleCreatorConfigRecord {
pub theme_text: String,
pub twist_rule: String,
pub shape_count: u32,
pub difficulty: u32,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleResultDraftRecord {
pub profile_id: String,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publish_ready: bool,
pub blockers: Vec<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAgentMessageRecord {
pub id: String,
pub role: String,
pub kind: String,
pub text: String,
pub created_at: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleAgentSessionRecord {
pub session_id: String,
pub current_turn: u32,
pub progress_percent: u32,
pub stage: String,
pub anchor_pack: SquareHoleAnchorPackRecord,
pub config: SquareHoleCreatorConfigRecord,
pub draft: Option<SquareHoleResultDraftRecord>,
pub messages: Vec<SquareHoleAgentMessageRecord>,
pub last_assistant_reply: Option<String>,
pub published_profile_id: Option<String>,
pub updated_at: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleWorkProfileRecord {
pub work_id: String,
pub profile_id: String,
pub owner_user_id: String,
pub source_session_id: Option<String>,
pub author_display_name: String,
pub game_name: String,
pub theme_text: String,
pub twist_rule: String,
pub summary: String,
pub tags: Vec<String>,
pub cover_image_src: Option<String>,
pub shape_count: u32,
pub difficulty: u32,
pub publication_status: String,
pub play_count: u32,
pub updated_at: String,
pub published_at: Option<String>,
pub publish_ready: bool,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleShapeSnapshotRecord {
pub shape_id: String,
pub shape_kind: String,
pub label: String,
pub color: String,
}
#[derive(Clone, Debug, PartialEq)]
pub struct SquareHoleHoleSnapshotRecord {
pub hole_id: String,
pub hole_kind: String,
pub label: String,
pub x: f32,
pub y: f32,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SquareHoleDropFeedbackRecord {
pub accepted: bool,
pub reject_reason: Option<String>,
pub message: String,
}
#[derive(Clone, Debug, PartialEq)]
pub struct SquareHoleRunRecord {
pub run_id: String,
pub profile_id: String,
pub owner_user_id: String,
pub status: String,
pub snapshot_version: u64,
pub started_at_ms: u64,
pub duration_limit_ms: u64,
pub server_now_ms: Option<u64>,
pub remaining_ms: u64,
pub total_shape_count: u32,
pub completed_shape_count: u32,
pub combo: u32,
pub best_combo: u32,
pub score: u32,
pub rule_label: String,
pub current_shape: Option<SquareHoleShapeSnapshotRecord>,
pub holes: Vec<SquareHoleHoleSnapshotRecord>,
pub last_feedback: Option<SquareHoleDropFeedbackRecord>,
pub last_confirmed_action_id: Option<String>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct SquareHoleDropConfirmationRecord {
pub status: String,
pub accepted: bool,
pub reject_reason: Option<String>,
pub failure_reason: Option<String>,
pub feedback: SquareHoleDropFeedbackRecord,
pub run: SquareHoleRunRecord,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleCreatorConfigJsonRecord {
theme_text: String,
twist_rule: String,
shape_count: u32,
difficulty: u32,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleAgentMessageJsonRecord {
message_id: String,
#[allow(dead_code)]
session_id: String,
role: String,
kind: String,
text: String,
created_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleDraftJsonRecord {
profile_id: String,
game_name: String,
theme_text: String,
twist_rule: String,
summary_text: String,
tags: Vec<String>,
shape_count: u32,
difficulty: u32,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleAgentSessionJsonRecord {
session_id: String,
#[allow(dead_code)]
owner_user_id: String,
#[allow(dead_code)]
seed_text: String,
current_turn: u32,
progress_percent: u32,
stage: String,
config: SquareHoleCreatorConfigJsonRecord,
draft: Option<SquareHoleDraftJsonRecord>,
messages: Vec<SquareHoleAgentMessageJsonRecord>,
last_assistant_reply: String,
published_profile_id: Option<String>,
#[allow(dead_code)]
created_at_micros: i64,
updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleWorkJsonRecord {
work_id: String,
profile_id: String,
owner_user_id: String,
source_session_id: String,
author_display_name: String,
game_name: String,
theme_text: String,
twist_rule: String,
summary_text: String,
tags: Vec<String>,
cover_image_src: String,
shape_count: u32,
difficulty: u32,
#[allow(dead_code)]
config: SquareHoleCreatorConfigJsonRecord,
publication_status: String,
publish_ready: bool,
play_count: u32,
updated_at_micros: i64,
published_at_micros: Option<i64>,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleShapeJsonRecord {
shape_id: String,
shape_kind: String,
label: String,
color: String,
}
#[derive(Clone, Debug, PartialEq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleHoleJsonRecord {
hole_id: String,
hole_kind: String,
label: String,
x: f32,
y: f32,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleDropFeedbackJsonRecord {
accepted: bool,
reject_reason: Option<String>,
message: String,
}
#[derive(Clone, Debug, PartialEq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct SquareHoleRunJsonRecord {
run_id: String,
profile_id: String,
owner_user_id: String,
status: String,
snapshot_version: u64,
started_at_ms: i64,
duration_limit_ms: i64,
server_now_ms: i64,
remaining_ms: i64,
total_shape_count: u32,
completed_shape_count: u32,
combo: u32,
best_combo: u32,
score: u32,
rule_label: String,
current_shape: Option<SquareHoleShapeJsonRecord>,
holes: Vec<SquareHoleHoleJsonRecord>,
last_feedback: Option<SquareHoleDropFeedbackJsonRecord>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleAnchorItemRecord {
pub key: String,

View File

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

View File

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

View File

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

View File

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

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,15 @@
// 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 AnalyticsDateDimensionEnsureInput {
pub date_key: i64,
}
impl __sdk::InModule for AnalyticsDateDimensionEnsureInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,16 @@
// 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 AnalyticsDateDimensionSeedInput {
pub start_date: String,
pub end_date: String,
}
impl __sdk::InModule for AnalyticsDateDimensionSeedInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,162 @@
// 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::analytics_date_dimension_type::AnalyticsDateDimension;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `analytics_date_dimension`.
///
/// Obtain a handle from the [`AnalyticsDateDimensionTableAccess::analytics_date_dimension`] method on [`super::RemoteTables`],
/// like `ctx.db.analytics_date_dimension()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.analytics_date_dimension().on_insert(...)`.
pub struct AnalyticsDateDimensionTableHandle<'ctx> {
imp: __sdk::TableHandle<AnalyticsDateDimension>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `analytics_date_dimension`.
///
/// Implemented for [`super::RemoteTables`].
pub trait AnalyticsDateDimensionTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`AnalyticsDateDimensionTableHandle`], which mediates access to the table `analytics_date_dimension`.
fn analytics_date_dimension(&self) -> AnalyticsDateDimensionTableHandle<'_>;
}
impl AnalyticsDateDimensionTableAccess for super::RemoteTables {
fn analytics_date_dimension(&self) -> AnalyticsDateDimensionTableHandle<'_> {
AnalyticsDateDimensionTableHandle {
imp: self
.imp
.get_table::<AnalyticsDateDimension>("analytics_date_dimension"),
ctx: std::marker::PhantomData,
}
}
}
pub struct AnalyticsDateDimensionInsertCallbackId(__sdk::CallbackId);
pub struct AnalyticsDateDimensionDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for AnalyticsDateDimensionTableHandle<'ctx> {
type Row = AnalyticsDateDimension;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AnalyticsDateDimension> + '_ {
self.imp.iter()
}
type InsertCallbackId = AnalyticsDateDimensionInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> AnalyticsDateDimensionInsertCallbackId {
AnalyticsDateDimensionInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: AnalyticsDateDimensionInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = AnalyticsDateDimensionDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> AnalyticsDateDimensionDeleteCallbackId {
AnalyticsDateDimensionDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: AnalyticsDateDimensionDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct AnalyticsDateDimensionUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for AnalyticsDateDimensionTableHandle<'ctx> {
type UpdateCallbackId = AnalyticsDateDimensionUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> AnalyticsDateDimensionUpdateCallbackId {
AnalyticsDateDimensionUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: AnalyticsDateDimensionUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `date_key` unique index on the table `analytics_date_dimension`,
/// which allows point queries on the field of the same name
/// via the [`AnalyticsDateDimensionDateKeyUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.analytics_date_dimension().date_key().find(...)`.
pub struct AnalyticsDateDimensionDateKeyUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AnalyticsDateDimension, i64>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AnalyticsDateDimensionTableHandle<'ctx> {
/// Get a handle on the `date_key` unique index on the table `analytics_date_dimension`.
pub fn date_key(&self) -> AnalyticsDateDimensionDateKeyUnique<'ctx> {
AnalyticsDateDimensionDateKeyUnique {
imp: self.imp.get_unique_constraint::<i64>("date_key"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AnalyticsDateDimensionDateKeyUnique<'ctx> {
/// Find the subscribed row whose `date_key` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &i64) -> Option<AnalyticsDateDimension> {
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::<AnalyticsDateDimension>("analytics_date_dimension");
_table.add_unique_constraint::<i64>("date_key", |row| &row.date_key);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AnalyticsDateDimension>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AnalyticsDateDimension>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AnalyticsDateDimension`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait analytics_date_dimensionQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AnalyticsDateDimension`.
fn analytics_date_dimension(&self) -> __sdk::__query_builder::Table<AnalyticsDateDimension>;
}
impl analytics_date_dimensionQueryTableAccess for __sdk::QueryTableAccessor {
fn analytics_date_dimension(&self) -> __sdk::__query_builder::Table<AnalyticsDateDimension> {
__sdk::__query_builder::Table::new("analytics_date_dimension")
}
}

View File

@@ -0,0 +1,120 @@
// 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 AnalyticsDateDimension {
pub date_key: i64,
pub calendar_date: String,
pub weekday: u8,
pub iso_week_key: i32,
pub week_start_date_key: i64,
pub week_end_date_key: i64,
pub month_key: i32,
pub month_start_date_key: i64,
pub month_end_date_key: i64,
pub quarter_key: i32,
pub quarter_start_date_key: i64,
pub quarter_end_date_key: i64,
pub year_key: i32,
pub year_start_date_key: i64,
pub year_end_date_key: i64,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AnalyticsDateDimension {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AnalyticsDateDimension`.
///
/// Provides typed access to columns for query building.
pub struct AnalyticsDateDimensionCols {
pub date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub calendar_date: __sdk::__query_builder::Col<AnalyticsDateDimension, String>,
pub weekday: __sdk::__query_builder::Col<AnalyticsDateDimension, u8>,
pub iso_week_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i32>,
pub week_start_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub week_end_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub month_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i32>,
pub month_start_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub month_end_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub quarter_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i32>,
pub quarter_start_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub quarter_end_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub year_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i32>,
pub year_start_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub year_end_date_key: __sdk::__query_builder::Col<AnalyticsDateDimension, i64>,
pub created_at: __sdk::__query_builder::Col<AnalyticsDateDimension, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<AnalyticsDateDimension, __sdk::Timestamp>,
}
impl __sdk::__query_builder::HasCols for AnalyticsDateDimension {
type Cols = AnalyticsDateDimensionCols;
fn cols(table_name: &'static str) -> Self::Cols {
AnalyticsDateDimensionCols {
date_key: __sdk::__query_builder::Col::new(table_name, "date_key"),
calendar_date: __sdk::__query_builder::Col::new(table_name, "calendar_date"),
weekday: __sdk::__query_builder::Col::new(table_name, "weekday"),
iso_week_key: __sdk::__query_builder::Col::new(table_name, "iso_week_key"),
week_start_date_key: __sdk::__query_builder::Col::new(
table_name,
"week_start_date_key",
),
week_end_date_key: __sdk::__query_builder::Col::new(table_name, "week_end_date_key"),
month_key: __sdk::__query_builder::Col::new(table_name, "month_key"),
month_start_date_key: __sdk::__query_builder::Col::new(
table_name,
"month_start_date_key",
),
month_end_date_key: __sdk::__query_builder::Col::new(table_name, "month_end_date_key"),
quarter_key: __sdk::__query_builder::Col::new(table_name, "quarter_key"),
quarter_start_date_key: __sdk::__query_builder::Col::new(
table_name,
"quarter_start_date_key",
),
quarter_end_date_key: __sdk::__query_builder::Col::new(
table_name,
"quarter_end_date_key",
),
year_key: __sdk::__query_builder::Col::new(table_name, "year_key"),
year_start_date_key: __sdk::__query_builder::Col::new(
table_name,
"year_start_date_key",
),
year_end_date_key: __sdk::__query_builder::Col::new(table_name, "year_end_date_key"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
/// Indexed column accessor struct for the table `AnalyticsDateDimension`.
///
/// Provides typed access to indexed columns for query building.
pub struct AnalyticsDateDimensionIxCols {
pub date_key: __sdk::__query_builder::IxCol<AnalyticsDateDimension, i64>,
pub iso_week_key: __sdk::__query_builder::IxCol<AnalyticsDateDimension, i32>,
pub month_key: __sdk::__query_builder::IxCol<AnalyticsDateDimension, i32>,
pub quarter_key: __sdk::__query_builder::IxCol<AnalyticsDateDimension, i32>,
pub year_key: __sdk::__query_builder::IxCol<AnalyticsDateDimension, i32>,
}
impl __sdk::__query_builder::HasIxCols for AnalyticsDateDimension {
type IxCols = AnalyticsDateDimensionIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
AnalyticsDateDimensionIxCols {
date_key: __sdk::__query_builder::IxCol::new(table_name, "date_key"),
iso_week_key: __sdk::__query_builder::IxCol::new(table_name, "iso_week_key"),
month_key: __sdk::__query_builder::IxCol::new(table_name, "month_key"),
quarter_key: __sdk::__query_builder::IxCol::new(table_name, "quarter_key"),
year_key: __sdk::__query_builder::IxCol::new(table_name, "year_key"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AnalyticsDateDimension {}

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

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

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

View File

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

View File

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

View File

@@ -0,0 +1,163 @@
// 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::battle_mode_type::BattleMode;
use super::battle_state_type::BattleState;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `battle_state`.
///
/// Obtain a handle from the [`BattleStateTableAccess::battle_state`] method on [`super::RemoteTables`],
/// like `ctx.db.battle_state()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().on_insert(...)`.
pub struct BattleStateTableHandle<'ctx> {
imp: __sdk::TableHandle<BattleState>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `battle_state`.
///
/// Implemented for [`super::RemoteTables`].
pub trait BattleStateTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`BattleStateTableHandle`], which mediates access to the table `battle_state`.
fn battle_state(&self) -> BattleStateTableHandle<'_>;
}
impl BattleStateTableAccess for super::RemoteTables {
fn battle_state(&self) -> BattleStateTableHandle<'_> {
BattleStateTableHandle {
imp: self.imp.get_table::<BattleState>("battle_state"),
ctx: std::marker::PhantomData,
}
}
}
pub struct BattleStateInsertCallbackId(__sdk::CallbackId);
pub struct BattleStateDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> {
type Row = BattleState;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ {
self.imp.iter()
}
type InsertCallbackId = BattleStateInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> BattleStateInsertCallbackId {
BattleStateInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: BattleStateInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = BattleStateDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> BattleStateDeleteCallbackId {
BattleStateDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: BattleStateDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct BattleStateUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> {
type UpdateCallbackId = BattleStateUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> BattleStateUpdateCallbackId {
BattleStateUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: BattleStateUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `battle_state_id` unique index on the table `battle_state`,
/// which allows point queries on the field of the same name
/// via the [`BattleStateBattleStateIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
pub struct BattleStateBattleStateIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> BattleStateTableHandle<'ctx> {
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
BattleStateBattleStateIdUnique {
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
/// Find the subscribed row whose `battle_state_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<BattleState> {
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::<BattleState>("battle_state");
_table.add_unique_constraint::<String>("battle_state_id", |row| &row.battle_state_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<BattleState>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<BattleState>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BattleState`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait battle_stateQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BattleState`.
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
}
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
__sdk::__query_builder::Table::new("battle_state")
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

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::square_hole_agent_session_procedure_result_type::SquareHoleAgentSessionProcedureResult;
use super::square_hole_draft_compile_input_type::SquareHoleDraftCompileInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CompileSquareHoleDraftArgs {
pub input: SquareHoleDraftCompileInput,
}
impl __sdk::InModule for CompileSquareHoleDraftArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `compile_square_hole_draft`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait compile_square_hole_draft {
fn compile_square_hole_draft(&self, input: SquareHoleDraftCompileInput) {
self.compile_square_hole_draft_then(input, |_, _| {});
}
fn compile_square_hole_draft_then(
&self,
input: SquareHoleDraftCompileInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl compile_square_hole_draft for super::RemoteProcedures {
fn compile_square_hole_draft_then(
&self,
input: SquareHoleDraftCompileInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleAgentSessionProcedureResult>(
"compile_square_hole_draft",
CompileSquareHoleDraftArgs { input },
__callback,
);
}
}

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::square_hole_agent_session_create_input_type::SquareHoleAgentSessionCreateInput;
use super::square_hole_agent_session_procedure_result_type::SquareHoleAgentSessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateSquareHoleAgentSessionArgs {
pub input: SquareHoleAgentSessionCreateInput,
}
impl __sdk::InModule for CreateSquareHoleAgentSessionArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `create_square_hole_agent_session`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_square_hole_agent_session {
fn create_square_hole_agent_session(&self, input: SquareHoleAgentSessionCreateInput) {
self.create_square_hole_agent_session_then(input, |_, _| {});
}
fn create_square_hole_agent_session_then(
&self,
input: SquareHoleAgentSessionCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl create_square_hole_agent_session for super::RemoteProcedures {
fn create_square_hole_agent_session_then(
&self,
input: SquareHoleAgentSessionCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleAgentSessionProcedureResult>(
"create_square_hole_agent_session",
CreateSquareHoleAgentSessionArgs { input },
__callback,
);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,170 @@
// 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::database_migration_operator_type::DatabaseMigrationOperator;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `database_migration_operator`.
///
/// Obtain a handle from the [`DatabaseMigrationOperatorTableAccess::database_migration_operator`] method on [`super::RemoteTables`],
/// like `ctx.db.database_migration_operator()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.database_migration_operator().on_insert(...)`.
pub struct DatabaseMigrationOperatorTableHandle<'ctx> {
imp: __sdk::TableHandle<DatabaseMigrationOperator>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `database_migration_operator`.
///
/// Implemented for [`super::RemoteTables`].
pub trait DatabaseMigrationOperatorTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`DatabaseMigrationOperatorTableHandle`], which mediates access to the table `database_migration_operator`.
fn database_migration_operator(&self) -> DatabaseMigrationOperatorTableHandle<'_>;
}
impl DatabaseMigrationOperatorTableAccess for super::RemoteTables {
fn database_migration_operator(&self) -> DatabaseMigrationOperatorTableHandle<'_> {
DatabaseMigrationOperatorTableHandle {
imp: self
.imp
.get_table::<DatabaseMigrationOperator>("database_migration_operator"),
ctx: std::marker::PhantomData,
}
}
}
pub struct DatabaseMigrationOperatorInsertCallbackId(__sdk::CallbackId);
pub struct DatabaseMigrationOperatorDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for DatabaseMigrationOperatorTableHandle<'ctx> {
type Row = DatabaseMigrationOperator;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = DatabaseMigrationOperator> + '_ {
self.imp.iter()
}
type InsertCallbackId = DatabaseMigrationOperatorInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> DatabaseMigrationOperatorInsertCallbackId {
DatabaseMigrationOperatorInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: DatabaseMigrationOperatorInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = DatabaseMigrationOperatorDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> DatabaseMigrationOperatorDeleteCallbackId {
DatabaseMigrationOperatorDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: DatabaseMigrationOperatorDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct DatabaseMigrationOperatorUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for DatabaseMigrationOperatorTableHandle<'ctx> {
type UpdateCallbackId = DatabaseMigrationOperatorUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> DatabaseMigrationOperatorUpdateCallbackId {
DatabaseMigrationOperatorUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: DatabaseMigrationOperatorUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `operator_identity` unique index on the table `database_migration_operator`,
/// which allows point queries on the field of the same name
/// via the [`DatabaseMigrationOperatorOperatorIdentityUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.database_migration_operator().operator_identity().find(...)`.
pub struct DatabaseMigrationOperatorOperatorIdentityUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<DatabaseMigrationOperator, __sdk::Identity>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> DatabaseMigrationOperatorTableHandle<'ctx> {
/// Get a handle on the `operator_identity` unique index on the table `database_migration_operator`.
pub fn operator_identity(&self) -> DatabaseMigrationOperatorOperatorIdentityUnique<'ctx> {
DatabaseMigrationOperatorOperatorIdentityUnique {
imp: self
.imp
.get_unique_constraint::<__sdk::Identity>("operator_identity"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> DatabaseMigrationOperatorOperatorIdentityUnique<'ctx> {
/// Find the subscribed row whose `operator_identity` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &__sdk::Identity) -> Option<DatabaseMigrationOperator> {
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::<DatabaseMigrationOperator>("database_migration_operator");
_table.add_unique_constraint::<__sdk::Identity>("operator_identity", |row| {
&row.operator_identity
});
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<DatabaseMigrationOperator>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<DatabaseMigrationOperator>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `DatabaseMigrationOperator`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait database_migration_operatorQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `DatabaseMigrationOperator`.
fn database_migration_operator(
&self,
) -> __sdk::__query_builder::Table<DatabaseMigrationOperator>;
}
impl database_migration_operatorQueryTableAccess for __sdk::QueryTableAccessor {
fn database_migration_operator(
&self,
) -> __sdk::__query_builder::Table<DatabaseMigrationOperator> {
__sdk::__query_builder::Table::new("database_migration_operator")
}
}

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::square_hole_work_delete_input_type::SquareHoleWorkDeleteInput;
use super::square_hole_works_procedure_result_type::SquareHoleWorksProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct DeleteSquareHoleWorkArgs {
pub input: SquareHoleWorkDeleteInput,
}
impl __sdk::InModule for DeleteSquareHoleWorkArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `delete_square_hole_work`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait delete_square_hole_work {
fn delete_square_hole_work(&self, input: SquareHoleWorkDeleteInput) {
self.delete_square_hole_work_then(input, |_, _| {});
}
fn delete_square_hole_work_then(
&self,
input: SquareHoleWorkDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorksProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl delete_square_hole_work for super::RemoteProcedures {
fn delete_square_hole_work_then(
&self,
input: SquareHoleWorkDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorksProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleWorksProcedureResult>(
"delete_square_hole_work",
DeleteSquareHoleWorkArgs { input },
__callback,
);
}
}

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::square_hole_drop_shape_procedure_result_type::SquareHoleDropShapeProcedureResult;
use super::square_hole_run_drop_input_type::SquareHoleRunDropInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct DropSquareHoleShapeArgs {
pub input: SquareHoleRunDropInput,
}
impl __sdk::InModule for DropSquareHoleShapeArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `drop_square_hole_shape`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait drop_square_hole_shape {
fn drop_square_hole_shape(&self, input: SquareHoleRunDropInput) {
self.drop_square_hole_shape_then(input, |_, _| {});
}
fn drop_square_hole_shape_then(
&self,
input: SquareHoleRunDropInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleDropShapeProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl drop_square_hole_shape for super::RemoteProcedures {
fn drop_square_hole_shape_then(
&self,
input: SquareHoleRunDropInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleDropShapeProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleDropShapeProcedureResult>(
"drop_square_hole_shape",
DropSquareHoleShapeArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,77 @@
// 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_date_dimension_ensure_input_type::AnalyticsDateDimensionEnsureInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct EnsureAnalyticsDateDimensionForDateArgs {
pub input: AnalyticsDateDimensionEnsureInput,
}
impl From<EnsureAnalyticsDateDimensionForDateArgs> for super::Reducer {
fn from(args: EnsureAnalyticsDateDimensionForDateArgs) -> Self {
Self::EnsureAnalyticsDateDimensionForDate { input: args.input }
}
}
impl __sdk::InModule for EnsureAnalyticsDateDimensionForDateArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `ensure_analytics_date_dimension_for_date`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait ensure_analytics_date_dimension_for_date {
/// Request that the remote module invoke the reducer `ensure_analytics_date_dimension_for_date` to run as soon as possible.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`ensure_analytics_date_dimension_for_date:ensure_analytics_date_dimension_for_date_then`] to run a callback after the reducer completes.
fn ensure_analytics_date_dimension_for_date(
&self,
input: AnalyticsDateDimensionEnsureInput,
) -> __sdk::Result<()> {
self.ensure_analytics_date_dimension_for_date_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `ensure_analytics_date_dimension_for_date` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
/// and its status can be observed with the `callback`.
fn ensure_analytics_date_dimension_for_date_then(
&self,
input: AnalyticsDateDimensionEnsureInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
) -> __sdk::Result<()>;
}
impl ensure_analytics_date_dimension_for_date for super::RemoteReducers {
fn ensure_analytics_date_dimension_for_date_then(
&self,
input: AnalyticsDateDimensionEnsureInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(
EnsureAnalyticsDateDimensionForDateArgs { input },
callback,
)
}
}

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::square_hole_agent_message_finalize_input_type::SquareHoleAgentMessageFinalizeInput;
use super::square_hole_agent_session_procedure_result_type::SquareHoleAgentSessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct FinalizeSquareHoleAgentMessageTurnArgs {
pub input: SquareHoleAgentMessageFinalizeInput,
}
impl __sdk::InModule for FinalizeSquareHoleAgentMessageTurnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `finalize_square_hole_agent_message_turn`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait finalize_square_hole_agent_message_turn {
fn finalize_square_hole_agent_message_turn(&self, input: SquareHoleAgentMessageFinalizeInput) {
self.finalize_square_hole_agent_message_turn_then(input, |_, _| {});
}
fn finalize_square_hole_agent_message_turn_then(
&self,
input: SquareHoleAgentMessageFinalizeInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl finalize_square_hole_agent_message_turn for super::RemoteProcedures {
fn finalize_square_hole_agent_message_turn_then(
&self,
input: SquareHoleAgentMessageFinalizeInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleAgentSessionProcedureResult>(
"finalize_square_hole_agent_message_turn",
FinalizeSquareHoleAgentMessageTurnArgs { input },
__callback,
);
}
}

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::square_hole_run_procedure_result_type::SquareHoleRunProcedureResult;
use super::square_hole_run_time_up_input_type::SquareHoleRunTimeUpInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct FinishSquareHoleTimeUpArgs {
pub input: SquareHoleRunTimeUpInput,
}
impl __sdk::InModule for FinishSquareHoleTimeUpArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `finish_square_hole_time_up`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait finish_square_hole_time_up {
fn finish_square_hole_time_up(&self, input: SquareHoleRunTimeUpInput) {
self.finish_square_hole_time_up_then(input, |_, _| {});
}
fn finish_square_hole_time_up_then(
&self,
input: SquareHoleRunTimeUpInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl finish_square_hole_time_up for super::RemoteProcedures {
fn finish_square_hole_time_up_then(
&self,
input: SquareHoleRunTimeUpInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleRunProcedureResult>(
"finish_square_hole_time_up",
FinishSquareHoleTimeUpArgs { input },
__callback,
);
}
}

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::square_hole_agent_session_get_input_type::SquareHoleAgentSessionGetInput;
use super::square_hole_agent_session_procedure_result_type::SquareHoleAgentSessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct GetSquareHoleAgentSessionArgs {
pub input: SquareHoleAgentSessionGetInput,
}
impl __sdk::InModule for GetSquareHoleAgentSessionArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `get_square_hole_agent_session`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait get_square_hole_agent_session {
fn get_square_hole_agent_session(&self, input: SquareHoleAgentSessionGetInput) {
self.get_square_hole_agent_session_then(input, |_, _| {});
}
fn get_square_hole_agent_session_then(
&self,
input: SquareHoleAgentSessionGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl get_square_hole_agent_session for super::RemoteProcedures {
fn get_square_hole_agent_session_then(
&self,
input: SquareHoleAgentSessionGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleAgentSessionProcedureResult>(
"get_square_hole_agent_session",
GetSquareHoleAgentSessionArgs { input },
__callback,
);
}
}

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::square_hole_run_get_input_type::SquareHoleRunGetInput;
use super::square_hole_run_procedure_result_type::SquareHoleRunProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct GetSquareHoleRunArgs {
pub input: SquareHoleRunGetInput,
}
impl __sdk::InModule for GetSquareHoleRunArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `get_square_hole_run`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait get_square_hole_run {
fn get_square_hole_run(&self, input: SquareHoleRunGetInput) {
self.get_square_hole_run_then(input, |_, _| {});
}
fn get_square_hole_run_then(
&self,
input: SquareHoleRunGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl get_square_hole_run for super::RemoteProcedures {
fn get_square_hole_run_then(
&self,
input: SquareHoleRunGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleRunProcedureResult>(
"get_square_hole_run",
GetSquareHoleRunArgs { input },
__callback,
);
}
}

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::square_hole_work_get_input_type::SquareHoleWorkGetInput;
use super::square_hole_work_procedure_result_type::SquareHoleWorkProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct GetSquareHoleWorkDetailArgs {
pub input: SquareHoleWorkGetInput,
}
impl __sdk::InModule for GetSquareHoleWorkDetailArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `get_square_hole_work_detail`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait get_square_hole_work_detail {
fn get_square_hole_work_detail(&self, input: SquareHoleWorkGetInput) {
self.get_square_hole_work_detail_then(input, |_, _| {});
}
fn get_square_hole_work_detail_then(
&self,
input: SquareHoleWorkGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorkProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl get_square_hole_work_detail for super::RemoteProcedures {
fn get_square_hole_work_detail_then(
&self,
input: SquareHoleWorkGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorkProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleWorkProcedureResult>(
"get_square_hole_work_detail",
GetSquareHoleWorkDetailArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,163 @@
// 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::inventory_container_kind_type::InventoryContainerKind;
use super::inventory_equipment_slot_type::InventoryEquipmentSlot;
use super::inventory_item_rarity_type::InventoryItemRarity;
use super::inventory_item_source_kind_type::InventoryItemSourceKind;
use super::inventory_slot_type::InventorySlot;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `inventory_slot`.
///
/// Obtain a handle from the [`InventorySlotTableAccess::inventory_slot`] method on [`super::RemoteTables`],
/// like `ctx.db.inventory_slot()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.inventory_slot().on_insert(...)`.
pub struct InventorySlotTableHandle<'ctx> {
imp: __sdk::TableHandle<InventorySlot>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `inventory_slot`.
///
/// Implemented for [`super::RemoteTables`].
pub trait InventorySlotTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`InventorySlotTableHandle`], which mediates access to the table `inventory_slot`.
fn inventory_slot(&self) -> InventorySlotTableHandle<'_>;
}
impl InventorySlotTableAccess for super::RemoteTables {
fn inventory_slot(&self) -> InventorySlotTableHandle<'_> {
InventorySlotTableHandle {
imp: self.imp.get_table::<InventorySlot>("inventory_slot"),
ctx: std::marker::PhantomData,
}
}
}
pub struct InventorySlotInsertCallbackId(__sdk::CallbackId);
pub struct InventorySlotDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for InventorySlotTableHandle<'ctx> {
type Row = InventorySlot;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = InventorySlot> + '_ {
self.imp.iter()
}
type InsertCallbackId = InventorySlotInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> InventorySlotInsertCallbackId {
InventorySlotInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: InventorySlotInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = InventorySlotDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> InventorySlotDeleteCallbackId {
InventorySlotDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: InventorySlotDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct InventorySlotUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for InventorySlotTableHandle<'ctx> {
type UpdateCallbackId = InventorySlotUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> InventorySlotUpdateCallbackId {
InventorySlotUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: InventorySlotUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `slot_id` unique index on the table `inventory_slot`,
/// which allows point queries on the field of the same name
/// via the [`InventorySlotSlotIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.inventory_slot().slot_id().find(...)`.
pub struct InventorySlotSlotIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<InventorySlot, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> InventorySlotTableHandle<'ctx> {
/// Get a handle on the `slot_id` unique index on the table `inventory_slot`.
pub fn slot_id(&self) -> InventorySlotSlotIdUnique<'ctx> {
InventorySlotSlotIdUnique {
imp: self.imp.get_unique_constraint::<String>("slot_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> InventorySlotSlotIdUnique<'ctx> {
/// Find the subscribed row whose `slot_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<InventorySlot> {
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::<InventorySlot>("inventory_slot");
_table.add_unique_constraint::<String>("slot_id", |row| &row.slot_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<InventorySlot>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<InventorySlot>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `InventorySlot`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait inventory_slotQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `InventorySlot`.
fn inventory_slot(&self) -> __sdk::__query_builder::Table<InventorySlot>;
}
impl inventory_slotQueryTableAccess for __sdk::QueryTableAccessor {
fn inventory_slot(&self) -> __sdk::__query_builder::Table<InventorySlot> {
__sdk::__query_builder::Table::new("inventory_slot")
}
}

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::square_hole_works_list_input_type::SquareHoleWorksListInput;
use super::square_hole_works_procedure_result_type::SquareHoleWorksProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ListSquareHoleWorksArgs {
pub input: SquareHoleWorksListInput,
}
impl __sdk::InModule for ListSquareHoleWorksArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `list_square_hole_works`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait list_square_hole_works {
fn list_square_hole_works(&self, input: SquareHoleWorksListInput) {
self.list_square_hole_works_then(input, |_, _| {});
}
fn list_square_hole_works_then(
&self,
input: SquareHoleWorksListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorksProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl list_square_hole_works for super::RemoteProcedures {
fn list_square_hole_works_then(
&self,
input: SquareHoleWorksListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<SquareHoleWorksProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, SquareHoleWorksProcedureResult>(
"list_square_hole_works",
ListSquareHoleWorksArgs { input },
__callback,
);
}
}

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,162 @@
// 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")
}
}

View File

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

View File

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

View File

@@ -12,6 +12,8 @@ pub struct ProfileInviteCode {
pub metadata_json: String,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
pub starts_at: Option<__sdk::Timestamp>,
pub expires_at: Option<__sdk::Timestamp>,
}
impl __sdk::InModule for ProfileInviteCode {
@@ -27,6 +29,8 @@ pub struct ProfileInviteCodeCols {
pub metadata_json: __sdk::__query_builder::Col<ProfileInviteCode, String>,
pub created_at: __sdk::__query_builder::Col<ProfileInviteCode, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<ProfileInviteCode, __sdk::Timestamp>,
pub starts_at: __sdk::__query_builder::Col<ProfileInviteCode, Option<__sdk::Timestamp>>,
pub expires_at: __sdk::__query_builder::Col<ProfileInviteCode, Option<__sdk::Timestamp>>,
}
impl __sdk::__query_builder::HasCols for ProfileInviteCode {
@@ -38,6 +42,8 @@ impl __sdk::__query_builder::HasCols for ProfileInviteCode {
metadata_json: __sdk::__query_builder::Col::new(table_name, "metadata_json"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
starts_at: __sdk::__query_builder::Col::new(table_name, "starts_at"),
expires_at: __sdk::__query_builder::Col::new(table_name, "expires_at"),
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More