moved generated,spacetime into it's own package + many other things
This commit is contained in:
11
packages/generated/Cargo.toml
Normal file
11
packages/generated/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "generated"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "generated"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
spacetimedb-sdk = "2.1.0"
|
||||
2
packages/generated/src/lib.rs
Normal file
2
packages/generated/src/lib.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub mod spacetime;
|
||||
|
||||
60
packages/generated/src/spacetime/action_type.rs
Normal file
60
packages/generated/src/spacetime/action_type.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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 Action {
|
||||
pub name: String,
|
||||
pub activity: Option<u64>,
|
||||
pub task: Option<u64>,
|
||||
pub start: Option<__sdk::Timestamp>,
|
||||
pub end: Option<__sdk::Timestamp>,
|
||||
pub duration: Option<u64>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Action {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `Action`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct ActionCols {
|
||||
pub name: __sdk::__query_builder::Col<Action, String>,
|
||||
pub activity: __sdk::__query_builder::Col<Action, Option<u64>>,
|
||||
pub task: __sdk::__query_builder::Col<Action, Option<u64>>,
|
||||
pub start: __sdk::__query_builder::Col<Action, Option<__sdk::Timestamp>>,
|
||||
pub end: __sdk::__query_builder::Col<Action, Option<__sdk::Timestamp>>,
|
||||
pub duration: __sdk::__query_builder::Col<Action, Option<u64>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Action {
|
||||
type Cols = ActionCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
ActionCols {
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
activity: __sdk::__query_builder::Col::new(table_name, "activity"),
|
||||
task: __sdk::__query_builder::Col::new(table_name, "task"),
|
||||
start: __sdk::__query_builder::Col::new(table_name, "start"),
|
||||
end: __sdk::__query_builder::Col::new(table_name, "end"),
|
||||
duration: __sdk::__query_builder::Col::new(table_name, "duration"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `Action`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct ActionIxCols {}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for Action {
|
||||
type IxCols = ActionIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
ActionIxCols {}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Action {}
|
||||
159
packages/generated/src/spacetime/activities_table.rs
Normal file
159
packages/generated/src/spacetime/activities_table.rs
Normal 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::activity_type::Activity;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `activities`.
|
||||
///
|
||||
/// Obtain a handle from the [`ActivitiesTableAccess::activities`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.activities()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.activities().on_insert(...)`.
|
||||
pub struct ActivitiesTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<Activity>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `activities`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait ActivitiesTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`ActivitiesTableHandle`], which mediates access to the table `activities`.
|
||||
fn activities(&self) -> ActivitiesTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl ActivitiesTableAccess for super::RemoteTables {
|
||||
fn activities(&self) -> ActivitiesTableHandle<'_> {
|
||||
ActivitiesTableHandle {
|
||||
imp: self.imp.get_table::<Activity>("activities"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ActivitiesInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct ActivitiesDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for ActivitiesTableHandle<'ctx> {
|
||||
type Row = Activity;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Activity> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = ActivitiesInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ActivitiesInsertCallbackId {
|
||||
ActivitiesInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: ActivitiesInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = ActivitiesDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ActivitiesDeleteCallbackId {
|
||||
ActivitiesDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: ActivitiesDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ActivitiesUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for ActivitiesTableHandle<'ctx> {
|
||||
type UpdateCallbackId = ActivitiesUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> ActivitiesUpdateCallbackId {
|
||||
ActivitiesUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: ActivitiesUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `activities`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`ActivitiesIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.activities().id().find(...)`.
|
||||
pub struct ActivitiesIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Activity, u64>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> ActivitiesTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `activities`.
|
||||
pub fn id(&self) -> ActivitiesIdUnique<'ctx> {
|
||||
ActivitiesIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u64>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> ActivitiesIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &u64) -> Option<Activity> {
|
||||
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::<Activity>("activities");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Activity>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Activity>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Activity`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait activitiesQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `Activity`.
|
||||
fn activities(&self) -> __sdk::__query_builder::Table<Activity>;
|
||||
}
|
||||
|
||||
impl activitiesQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn activities(&self) -> __sdk::__query_builder::Table<Activity> {
|
||||
__sdk::__query_builder::Table::new("activities")
|
||||
}
|
||||
}
|
||||
58
packages/generated/src/spacetime/activity_type.rs
Normal file
58
packages/generated/src/spacetime/activity_type.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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 Activity {
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
pub task: Option<u64>,
|
||||
pub parents_ids: Vec<u64>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Activity {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `Activity`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct ActivityCols {
|
||||
pub id: __sdk::__query_builder::Col<Activity, u64>,
|
||||
pub name: __sdk::__query_builder::Col<Activity, String>,
|
||||
pub task: __sdk::__query_builder::Col<Activity, Option<u64>>,
|
||||
pub parents_ids: __sdk::__query_builder::Col<Activity, Vec<u64>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Activity {
|
||||
type Cols = ActivityCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
ActivityCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
task: __sdk::__query_builder::Col::new(table_name, "task"),
|
||||
parents_ids: __sdk::__query_builder::Col::new(table_name, "parents_ids"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `Activity`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct ActivityIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<Activity, u64>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for Activity {
|
||||
type IxCols = ActivityIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
ActivityIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Activity {}
|
||||
66
packages/generated/src/spacetime/add_activity_reducer.rs
Normal file
66
packages/generated/src/spacetime/add_activity_reducer.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
// 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(super) struct AddActivityArgs {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl From<AddActivityArgs> for super::Reducer {
|
||||
fn from(args: AddActivityArgs) -> Self {
|
||||
Self::AddActivity { name: args.name }
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for AddActivityArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `add_activity`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait add_activity {
|
||||
/// Request that the remote module invoke the reducer `add_activity` 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 [`add_activity:add_activity_then`] to run a callback after the reducer completes.
|
||||
fn add_activity(&self, name: String) -> __sdk::Result<()> {
|
||||
self.add_activity_then(name, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `add_activity` 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 add_activity_then(
|
||||
&self,
|
||||
name: String,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl add_activity for super::RemoteReducers {
|
||||
fn add_activity_then(
|
||||
&self,
|
||||
name: String,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(AddActivityArgs { name }, callback)
|
||||
}
|
||||
}
|
||||
60
packages/generated/src/spacetime/log_event_type.rs
Normal file
60
packages/generated/src/spacetime/log_event_type.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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::action_type::Action;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct LogEvent {
|
||||
pub id: u64,
|
||||
pub start: __sdk::Timestamp,
|
||||
pub end: __sdk::Timestamp,
|
||||
pub action: Action,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for LogEvent {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `LogEvent`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct LogEventCols {
|
||||
pub id: __sdk::__query_builder::Col<LogEvent, u64>,
|
||||
pub start: __sdk::__query_builder::Col<LogEvent, __sdk::Timestamp>,
|
||||
pub end: __sdk::__query_builder::Col<LogEvent, __sdk::Timestamp>,
|
||||
pub action: __sdk::__query_builder::Col<LogEvent, Action>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for LogEvent {
|
||||
type Cols = LogEventCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
LogEventCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
start: __sdk::__query_builder::Col::new(table_name, "start"),
|
||||
end: __sdk::__query_builder::Col::new(table_name, "end"),
|
||||
action: __sdk::__query_builder::Col::new(table_name, "action"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `LogEvent`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct LogEventIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<LogEvent, u64>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for LogEvent {
|
||||
type IxCols = LogEventIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
LogEventIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for LogEvent {}
|
||||
160
packages/generated/src/spacetime/log_events_table.rs
Normal file
160
packages/generated/src/spacetime/log_events_table.rs
Normal 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::action_type::Action;
|
||||
use super::log_event_type::LogEvent;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `log_events`.
|
||||
///
|
||||
/// Obtain a handle from the [`LogEventsTableAccess::log_events`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.log_events()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.log_events().on_insert(...)`.
|
||||
pub struct LogEventsTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<LogEvent>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `log_events`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait LogEventsTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`LogEventsTableHandle`], which mediates access to the table `log_events`.
|
||||
fn log_events(&self) -> LogEventsTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl LogEventsTableAccess for super::RemoteTables {
|
||||
fn log_events(&self) -> LogEventsTableHandle<'_> {
|
||||
LogEventsTableHandle {
|
||||
imp: self.imp.get_table::<LogEvent>("log_events"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LogEventsInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct LogEventsDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for LogEventsTableHandle<'ctx> {
|
||||
type Row = LogEvent;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = LogEvent> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = LogEventsInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> LogEventsInsertCallbackId {
|
||||
LogEventsInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: LogEventsInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = LogEventsDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> LogEventsDeleteCallbackId {
|
||||
LogEventsDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: LogEventsDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LogEventsUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for LogEventsTableHandle<'ctx> {
|
||||
type UpdateCallbackId = LogEventsUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> LogEventsUpdateCallbackId {
|
||||
LogEventsUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: LogEventsUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `log_events`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`LogEventsIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.log_events().id().find(...)`.
|
||||
pub struct LogEventsIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<LogEvent, u64>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> LogEventsTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `log_events`.
|
||||
pub fn id(&self) -> LogEventsIdUnique<'ctx> {
|
||||
LogEventsIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u64>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> LogEventsIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &u64) -> Option<LogEvent> {
|
||||
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::<LogEvent>("log_events");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<LogEvent>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<LogEvent>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `LogEvent`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait log_eventsQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `LogEvent`.
|
||||
fn log_events(&self) -> __sdk::__query_builder::Table<LogEvent>;
|
||||
}
|
||||
|
||||
impl log_eventsQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn log_events(&self) -> __sdk::__query_builder::Table<LogEvent> {
|
||||
__sdk::__query_builder::Table::new("log_events")
|
||||
}
|
||||
}
|
||||
939
packages/generated/src/spacetime/mod.rs
Normal file
939
packages/generated/src/spacetime/mod.rs
Normal file
@@ -0,0 +1,939 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 2.1.0 (commit refs/tags/v2.1.0).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
pub mod action_type;
|
||||
pub mod activities_table;
|
||||
pub mod activity_type;
|
||||
pub mod add_activity_reducer;
|
||||
pub mod log_event_type;
|
||||
pub mod log_events_table;
|
||||
pub mod next_action_reducer;
|
||||
pub mod profile_type;
|
||||
pub mod profiles_table;
|
||||
pub mod remove_activity_reducer;
|
||||
pub mod set_activity_name_reducer;
|
||||
pub mod task_part_table;
|
||||
pub mod task_part_type;
|
||||
pub mod task_type;
|
||||
pub mod tasks_table;
|
||||
pub mod update_activity_reducer;
|
||||
pub mod update_upcoming_reducer;
|
||||
|
||||
pub use action_type::Action;
|
||||
pub use activities_table::*;
|
||||
pub use activity_type::Activity;
|
||||
pub use add_activity_reducer::add_activity;
|
||||
pub use log_event_type::LogEvent;
|
||||
pub use log_events_table::*;
|
||||
pub use next_action_reducer::next_action;
|
||||
pub use profile_type::Profile;
|
||||
pub use profiles_table::*;
|
||||
pub use remove_activity_reducer::remove_activity;
|
||||
pub use set_activity_name_reducer::set_activity_name;
|
||||
pub use task_part_table::*;
|
||||
pub use task_part_type::TaskPart;
|
||||
pub use task_type::Task;
|
||||
pub use tasks_table::*;
|
||||
pub use update_activity_reducer::update_activity;
|
||||
pub use update_upcoming_reducer::update_upcoming;
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
|
||||
/// One of the reducers defined by this module.
|
||||
///
|
||||
/// Contained within a [`__sdk::ReducerEvent`] in [`EventContext`]s for reducer events
|
||||
/// to indicate which reducer caused the event.
|
||||
|
||||
pub enum Reducer {
|
||||
AddActivity { name: String },
|
||||
NextAction,
|
||||
RemoveActivity { activity: Activity },
|
||||
SetActivityName { id: u64, name: String },
|
||||
UpdateActivity { activity: Activity },
|
||||
UpdateUpcoming { upcoming: Vec<Action> },
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Reducer {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::Reducer for Reducer {
|
||||
fn reducer_name(&self) -> &'static str {
|
||||
match self {
|
||||
Reducer::AddActivity { .. } => "add_activity",
|
||||
Reducer::NextAction => "next_action",
|
||||
Reducer::RemoveActivity { .. } => "remove_activity",
|
||||
Reducer::SetActivityName { .. } => "set_activity_name",
|
||||
Reducer::UpdateActivity { .. } => "update_activity",
|
||||
Reducer::UpdateUpcoming { .. } => "update_upcoming",
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
#[allow(clippy::clone_on_copy)]
|
||||
fn args_bsatn(&self) -> Result<Vec<u8>, __sats::bsatn::EncodeError> {
|
||||
match self {
|
||||
Reducer::AddActivity { name } => {
|
||||
__sats::bsatn::to_vec(&add_activity_reducer::AddActivityArgs { name: name.clone() })
|
||||
}
|
||||
Reducer::NextAction => __sats::bsatn::to_vec(&next_action_reducer::NextActionArgs {}),
|
||||
Reducer::RemoveActivity { activity } => {
|
||||
__sats::bsatn::to_vec(&remove_activity_reducer::RemoveActivityArgs {
|
||||
activity: activity.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::SetActivityName { id, name } => {
|
||||
__sats::bsatn::to_vec(&set_activity_name_reducer::SetActivityNameArgs {
|
||||
id: id.clone(),
|
||||
name: name.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::UpdateActivity { activity } => {
|
||||
__sats::bsatn::to_vec(&update_activity_reducer::UpdateActivityArgs {
|
||||
activity: activity.clone(),
|
||||
})
|
||||
}
|
||||
Reducer::UpdateUpcoming { upcoming } => {
|
||||
__sats::bsatn::to_vec(&update_upcoming_reducer::UpdateUpcomingArgs {
|
||||
upcoming: upcoming.clone(),
|
||||
})
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
#[doc(hidden)]
|
||||
pub struct DbUpdate {
|
||||
activities: __sdk::TableUpdate<Activity>,
|
||||
log_events: __sdk::TableUpdate<LogEvent>,
|
||||
profiles: __sdk::TableUpdate<Profile>,
|
||||
task_part: __sdk::TableUpdate<TaskPart>,
|
||||
tasks: __sdk::TableUpdate<Task>,
|
||||
}
|
||||
|
||||
impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
|
||||
type Error = __sdk::Error;
|
||||
fn try_from(raw: __ws::v2::TransactionUpdate) -> Result<Self, Self::Error> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_update in __sdk::transaction_update_iter_table_updates(raw) {
|
||||
match &table_update.table_name[..] {
|
||||
"activities" => db_update
|
||||
.activities
|
||||
.append(activities_table::parse_table_update(table_update)?),
|
||||
"log_events" => db_update
|
||||
.log_events
|
||||
.append(log_events_table::parse_table_update(table_update)?),
|
||||
"profiles" => db_update
|
||||
.profiles
|
||||
.append(profiles_table::parse_table_update(table_update)?),
|
||||
"task_part" => db_update
|
||||
.task_part
|
||||
.append(task_part_table::parse_table_update(table_update)?),
|
||||
"tasks" => db_update
|
||||
.tasks
|
||||
.append(tasks_table::parse_table_update(table_update)?),
|
||||
|
||||
unknown => {
|
||||
return Err(__sdk::InternalError::unknown_name(
|
||||
"table",
|
||||
unknown,
|
||||
"DatabaseUpdate",
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(db_update)
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for DbUpdate {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbUpdate for DbUpdate {
|
||||
fn apply_to_client_cache(
|
||||
&self,
|
||||
cache: &mut __sdk::ClientCache<RemoteModule>,
|
||||
) -> AppliedDiff<'_> {
|
||||
let mut diff = AppliedDiff::default();
|
||||
|
||||
diff.activities = cache
|
||||
.apply_diff_to_table::<Activity>("activities", &self.activities)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.log_events = cache
|
||||
.apply_diff_to_table::<LogEvent>("log_events", &self.log_events)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.profiles = cache
|
||||
.apply_diff_to_table::<Profile>("profiles", &self.profiles)
|
||||
.with_updates_by_pk(|row| &row.identity);
|
||||
diff.task_part = cache
|
||||
.apply_diff_to_table::<TaskPart>("task_part", &self.task_part)
|
||||
.with_updates_by_pk(|row| &row.identity);
|
||||
diff.tasks = cache
|
||||
.apply_diff_to_table::<Task>("tasks", &self.tasks)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
|
||||
diff
|
||||
}
|
||||
fn parse_initial_rows(raw: __ws::v2::QueryRows) -> __sdk::Result<Self> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_rows in raw.tables {
|
||||
match &table_rows.table[..] {
|
||||
"activities" => db_update
|
||||
.activities
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"log_events" => db_update
|
||||
.log_events
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"profiles" => db_update
|
||||
.profiles
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"task_part" => db_update
|
||||
.task_part
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"tasks" => db_update
|
||||
.tasks
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
unknown => {
|
||||
return Err(
|
||||
__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(db_update)
|
||||
}
|
||||
fn parse_unsubscribe_rows(raw: __ws::v2::QueryRows) -> __sdk::Result<Self> {
|
||||
let mut db_update = DbUpdate::default();
|
||||
for table_rows in raw.tables {
|
||||
match &table_rows.table[..] {
|
||||
"activities" => db_update
|
||||
.activities
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"log_events" => db_update
|
||||
.log_events
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"profiles" => db_update
|
||||
.profiles
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"task_part" => db_update
|
||||
.task_part
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"tasks" => db_update
|
||||
.tasks
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
unknown => {
|
||||
return Err(
|
||||
__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(db_update)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[allow(non_snake_case)]
|
||||
#[doc(hidden)]
|
||||
pub struct AppliedDiff<'r> {
|
||||
activities: __sdk::TableAppliedDiff<'r, Activity>,
|
||||
log_events: __sdk::TableAppliedDiff<'r, LogEvent>,
|
||||
profiles: __sdk::TableAppliedDiff<'r, Profile>,
|
||||
task_part: __sdk::TableAppliedDiff<'r, TaskPart>,
|
||||
tasks: __sdk::TableAppliedDiff<'r, Task>,
|
||||
__unused: std::marker::PhantomData<&'r ()>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for AppliedDiff<'_> {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
||||
fn invoke_row_callbacks(
|
||||
&self,
|
||||
event: &EventContext,
|
||||
callbacks: &mut __sdk::DbCallbacks<RemoteModule>,
|
||||
) {
|
||||
callbacks.invoke_table_row_callbacks::<Activity>("activities", &self.activities, event);
|
||||
callbacks.invoke_table_row_callbacks::<LogEvent>("log_events", &self.log_events, event);
|
||||
callbacks.invoke_table_row_callbacks::<Profile>("profiles", &self.profiles, event);
|
||||
callbacks.invoke_table_row_callbacks::<TaskPart>("task_part", &self.task_part, event);
|
||||
callbacks.invoke_table_row_callbacks::<Task>("tasks", &self.tasks, event);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[derive(Debug)]
|
||||
pub struct RemoteModule;
|
||||
|
||||
impl __sdk::InModule for RemoteModule {
|
||||
type Module = Self;
|
||||
}
|
||||
|
||||
/// The `reducers` field of [`EventContext`] and [`DbConnection`],
|
||||
/// with methods provided by extension traits for each reducer defined by the module.
|
||||
pub struct RemoteReducers {
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RemoteReducers {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
/// The `procedures` field of [`DbConnection`] and other [`DbContext`] types,
|
||||
/// with methods provided by extension traits for each procedure defined by the module.
|
||||
pub struct RemoteProcedures {
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RemoteProcedures {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
/// The `db` field of [`EventContext`] and [`DbConnection`],
|
||||
/// with methods provided by extension traits for each table defined by the module.
|
||||
pub struct RemoteTables {
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RemoteTables {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
/// A connection to a remote module, including a materialized view of a subset of the database.
|
||||
///
|
||||
/// Connect to a remote module by calling [`DbConnection::builder`]
|
||||
/// and using the [`__sdk::DbConnectionBuilder`] builder-pattern constructor.
|
||||
///
|
||||
/// You must explicitly advance the connection by calling any one of:
|
||||
///
|
||||
/// - [`DbConnection::frame_tick`].
|
||||
#[cfg_attr(not(target_arch = "wasm32"), doc = "- [`DbConnection::run_threaded`].")]
|
||||
#[cfg_attr(
|
||||
target_arch = "wasm32",
|
||||
doc = "- [`DbConnection::run_background_task`]."
|
||||
)]
|
||||
/// - [`DbConnection::run_async`].
|
||||
/// - [`DbConnection::advance_one_message`].
|
||||
#[cfg_attr(
|
||||
not(target_arch = "wasm32"),
|
||||
doc = "- [`DbConnection::advance_one_message_blocking`]."
|
||||
)]
|
||||
/// - [`DbConnection::advance_one_message_async`].
|
||||
///
|
||||
/// Which of these methods you should call depends on the specific needs of your application,
|
||||
/// but you must call one of them, or else the connection will never progress.
|
||||
pub struct DbConnection {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
#[doc(hidden)]
|
||||
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for DbConnection {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for DbConnection {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl DbConnection {
|
||||
/// Builder-pattern constructor for a connection to a remote module.
|
||||
///
|
||||
/// See [`__sdk::DbConnectionBuilder`] for required and optional configuration for the new connection.
|
||||
pub fn builder() -> __sdk::DbConnectionBuilder<RemoteModule> {
|
||||
__sdk::DbConnectionBuilder::new()
|
||||
}
|
||||
|
||||
/// If any WebSocket messages are waiting, process one of them.
|
||||
///
|
||||
/// Returns `true` if a message was processed, or `false` if the queue is empty.
|
||||
/// Callers should invoke this message in a loop until it returns `false`
|
||||
/// or for as much time is available to process messages.
|
||||
///
|
||||
/// Returns an error if the connection is disconnected.
|
||||
/// If the disconnection in question was normal,
|
||||
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
|
||||
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
|
||||
///
|
||||
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
|
||||
/// Most applications should call [`Self::frame_tick`] each frame
|
||||
/// to fully exhaust the queue whenever time is available.
|
||||
pub fn advance_one_message(&self) -> __sdk::Result<bool> {
|
||||
self.imp.advance_one_message()
|
||||
}
|
||||
|
||||
/// Process one WebSocket message, potentially blocking the current thread until one is received.
|
||||
///
|
||||
/// Returns an error if the connection is disconnected.
|
||||
/// If the disconnection in question was normal,
|
||||
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
|
||||
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
|
||||
///
|
||||
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
|
||||
/// Most applications should call [`Self::run_threaded`] to spawn a thread
|
||||
/// which advances the connection automatically.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn advance_one_message_blocking(&self) -> __sdk::Result<()> {
|
||||
self.imp.advance_one_message_blocking()
|
||||
}
|
||||
|
||||
/// Process one WebSocket message, `await`ing until one is received.
|
||||
///
|
||||
/// Returns an error if the connection is disconnected.
|
||||
/// If the disconnection in question was normal,
|
||||
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
|
||||
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
|
||||
///
|
||||
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
|
||||
/// Most applications should call [`Self::run_async`] to run an `async` loop
|
||||
/// which advances the connection when polled.
|
||||
pub async fn advance_one_message_async(&self) -> __sdk::Result<()> {
|
||||
self.imp.advance_one_message_async().await
|
||||
}
|
||||
|
||||
/// Process all WebSocket messages waiting in the queue,
|
||||
/// then return without `await`ing or blocking the current thread.
|
||||
pub fn frame_tick(&self) -> __sdk::Result<()> {
|
||||
self.imp.frame_tick()
|
||||
}
|
||||
|
||||
/// Spawn a thread which processes WebSocket messages as they are received.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn run_threaded(&self) -> std::thread::JoinHandle<()> {
|
||||
self.imp.run_threaded()
|
||||
}
|
||||
|
||||
/// Spawn a background task which processes WebSocket messages as they are received.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub fn run_background_task(&self) {
|
||||
self.imp.run_background_task()
|
||||
}
|
||||
|
||||
/// Run an `async` loop which processes WebSocket messages when polled.
|
||||
pub async fn run_async(&self) -> __sdk::Result<()> {
|
||||
self.imp.run_async().await
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::DbConnection for DbConnection {
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A handle on a subscribed query.
|
||||
// TODO: Document this better after implementing the new subscription API.
|
||||
#[derive(Clone)]
|
||||
pub struct SubscriptionHandle {
|
||||
imp: __sdk::SubscriptionHandleImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for SubscriptionHandle {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::SubscriptionHandle for SubscriptionHandle {
|
||||
fn new(imp: __sdk::SubscriptionHandleImpl<RemoteModule>) -> Self {
|
||||
Self { imp }
|
||||
}
|
||||
|
||||
/// Returns true if this subscription has been terminated due to an unsubscribe call or an error.
|
||||
fn is_ended(&self) -> bool {
|
||||
self.imp.is_ended()
|
||||
}
|
||||
|
||||
/// Returns true if this subscription has been applied and has not yet been unsubscribed.
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
/// Unsubscribe from the query controlled by this `SubscriptionHandle`,
|
||||
/// then run `on_end` when its rows are removed from the client cache.
|
||||
fn unsubscribe_then(self, on_end: __sdk::OnEndedCallback<RemoteModule>) -> __sdk::Result<()> {
|
||||
self.imp.unsubscribe_then(Some(on_end))
|
||||
}
|
||||
|
||||
fn unsubscribe(self) -> __sdk::Result<()> {
|
||||
self.imp.unsubscribe_then(None)
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias trait for a [`__sdk::DbContext`] connected to this module,
|
||||
/// with that trait's associated types bounded to this module's concrete types.
|
||||
///
|
||||
/// Users can use this trait as a boundary on definitions which should accept
|
||||
/// either a [`DbConnection`] or an [`EventContext`] and operate on either.
|
||||
pub trait RemoteDbContext:
|
||||
__sdk::DbContext<
|
||||
DbView = RemoteTables,
|
||||
Reducers = RemoteReducers,
|
||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||
>
|
||||
{
|
||||
}
|
||||
impl<
|
||||
Ctx: __sdk::DbContext<
|
||||
DbView = RemoteTables,
|
||||
Reducers = RemoteReducers,
|
||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||
>,
|
||||
> RemoteDbContext for Ctx
|
||||
{
|
||||
}
|
||||
|
||||
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`],
|
||||
/// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks.
|
||||
pub struct EventContext {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
pub event: __sdk::Event<Reducer>,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::AbstractEventContext for EventContext {
|
||||
type Event = __sdk::Event<Reducer>;
|
||||
fn event(&self) -> &Self::Event {
|
||||
&self.event
|
||||
}
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>, event: Self::Event) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for EventContext {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for EventContext {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::EventContext for EventContext {}
|
||||
|
||||
/// An [`__sdk::DbContext`] augmented with a [`__sdk::ReducerEvent`],
|
||||
/// passed to on-reducer callbacks.
|
||||
pub struct ReducerEventContext {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
pub event: __sdk::ReducerEvent<Reducer>,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::AbstractEventContext for ReducerEventContext {
|
||||
type Event = __sdk::ReducerEvent<Reducer>;
|
||||
fn event(&self) -> &Self::Event {
|
||||
&self.event
|
||||
}
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>, event: Self::Event) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ReducerEventContext {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for ReducerEventContext {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::ReducerEventContext for ReducerEventContext {}
|
||||
|
||||
/// An [`__sdk::DbContext`] passed to procedure callbacks.
|
||||
pub struct ProcedureEventContext {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::AbstractEventContext for ProcedureEventContext {
|
||||
type Event = ();
|
||||
fn event(&self) -> &Self::Event {
|
||||
&()
|
||||
}
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>, _event: Self::Event) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ProcedureEventContext {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for ProcedureEventContext {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::ProcedureEventContext for ProcedureEventContext {}
|
||||
|
||||
/// An [`__sdk::DbContext`] passed to [`__sdk::SubscriptionBuilder::on_applied`] and [`SubscriptionHandle::unsubscribe_then`] callbacks.
|
||||
pub struct SubscriptionEventContext {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::AbstractEventContext for SubscriptionEventContext {
|
||||
type Event = ();
|
||||
fn event(&self) -> &Self::Event {
|
||||
&()
|
||||
}
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>, _event: Self::Event) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for SubscriptionEventContext {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for SubscriptionEventContext {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::SubscriptionEventContext for SubscriptionEventContext {}
|
||||
|
||||
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Error`],
|
||||
/// passed to [`__sdk::DbConnectionBuilder::on_disconnect`], [`__sdk::DbConnectionBuilder::on_connect_error`] and [`__sdk::SubscriptionBuilder::on_error`] callbacks.
|
||||
pub struct ErrorContext {
|
||||
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
|
||||
pub db: RemoteTables,
|
||||
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
|
||||
pub reducers: RemoteReducers,
|
||||
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
|
||||
pub procedures: RemoteProcedures,
|
||||
/// The event which caused these callbacks to run.
|
||||
pub event: Option<__sdk::Error>,
|
||||
imp: __sdk::DbContextImpl<RemoteModule>,
|
||||
}
|
||||
|
||||
impl __sdk::AbstractEventContext for ErrorContext {
|
||||
type Event = Option<__sdk::Error>;
|
||||
fn event(&self) -> &Self::Event {
|
||||
&self.event
|
||||
}
|
||||
fn new(imp: __sdk::DbContextImpl<RemoteModule>, event: Self::Event) -> Self {
|
||||
Self {
|
||||
db: RemoteTables { imp: imp.clone() },
|
||||
reducers: RemoteReducers { imp: imp.clone() },
|
||||
procedures: RemoteProcedures { imp: imp.clone() },
|
||||
event,
|
||||
imp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ErrorContext {
|
||||
type Module = RemoteModule;
|
||||
}
|
||||
|
||||
impl __sdk::DbContext for ErrorContext {
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
|
||||
fn db(&self) -> &Self::DbView {
|
||||
&self.db
|
||||
}
|
||||
fn reducers(&self) -> &Self::Reducers {
|
||||
&self.reducers
|
||||
}
|
||||
fn procedures(&self) -> &Self::Procedures {
|
||||
&self.procedures
|
||||
}
|
||||
|
||||
fn is_active(&self) -> bool {
|
||||
self.imp.is_active()
|
||||
}
|
||||
|
||||
fn disconnect(&self) -> __sdk::Result<()> {
|
||||
self.imp.disconnect()
|
||||
}
|
||||
|
||||
type SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>;
|
||||
|
||||
fn subscription_builder(&self) -> Self::SubscriptionBuilder {
|
||||
__sdk::SubscriptionBuilder::new(&self.imp)
|
||||
}
|
||||
|
||||
fn try_identity(&self) -> Option<__sdk::Identity> {
|
||||
self.imp.try_identity()
|
||||
}
|
||||
fn connection_id(&self) -> __sdk::ConnectionId {
|
||||
self.imp.connection_id()
|
||||
}
|
||||
fn try_connection_id(&self) -> Option<__sdk::ConnectionId> {
|
||||
self.imp.try_connection_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::ErrorContext for ErrorContext {}
|
||||
|
||||
impl __sdk::SpacetimeModule for RemoteModule {
|
||||
type DbConnection = DbConnection;
|
||||
type EventContext = EventContext;
|
||||
type ReducerEventContext = ReducerEventContext;
|
||||
type ProcedureEventContext = ProcedureEventContext;
|
||||
type SubscriptionEventContext = SubscriptionEventContext;
|
||||
type ErrorContext = ErrorContext;
|
||||
type Reducer = Reducer;
|
||||
type DbView = RemoteTables;
|
||||
type Reducers = RemoteReducers;
|
||||
type Procedures = RemoteProcedures;
|
||||
type DbUpdate = DbUpdate;
|
||||
type AppliedDiff<'r> = AppliedDiff<'r>;
|
||||
type SubscriptionHandle = SubscriptionHandle;
|
||||
type QueryBuilder = __sdk::QueryBuilder;
|
||||
|
||||
fn register_tables(client_cache: &mut __sdk::ClientCache<Self>) {
|
||||
activities_table::register_table(client_cache);
|
||||
log_events_table::register_table(client_cache);
|
||||
profiles_table::register_table(client_cache);
|
||||
task_part_table::register_table(client_cache);
|
||||
tasks_table::register_table(client_cache);
|
||||
}
|
||||
const ALL_TABLE_NAMES: &'static [&'static str] =
|
||||
&["activities", "log_events", "profiles", "task_part", "tasks"];
|
||||
}
|
||||
62
packages/generated/src/spacetime/next_action_reducer.rs
Normal file
62
packages/generated/src/spacetime/next_action_reducer.rs
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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(super) struct NextActionArgs {}
|
||||
|
||||
impl From<NextActionArgs> for super::Reducer {
|
||||
fn from(args: NextActionArgs) -> Self {
|
||||
Self::NextAction
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for NextActionArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `next_action`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait next_action {
|
||||
/// Request that the remote module invoke the reducer `next_action` 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 [`next_action:next_action_then`] to run a callback after the reducer completes.
|
||||
fn next_action(&self) -> __sdk::Result<()> {
|
||||
self.next_action_then(|_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `next_action` 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 next_action_then(
|
||||
&self,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl next_action for super::RemoteReducers {
|
||||
fn next_action_then(
|
||||
&self,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(NextActionArgs {}, callback)
|
||||
}
|
||||
}
|
||||
54
packages/generated/src/spacetime/profile_type.rs
Normal file
54
packages/generated/src/spacetime/profile_type.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
// 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 Profile {
|
||||
pub identity: __sdk::Identity,
|
||||
pub username: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Profile {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `Profile`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct ProfileCols {
|
||||
pub identity: __sdk::__query_builder::Col<Profile, __sdk::Identity>,
|
||||
pub username: __sdk::__query_builder::Col<Profile, String>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Profile {
|
||||
type Cols = ProfileCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
ProfileCols {
|
||||
identity: __sdk::__query_builder::Col::new(table_name, "identity"),
|
||||
username: __sdk::__query_builder::Col::new(table_name, "username"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `Profile`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct ProfileIxCols {
|
||||
pub identity: __sdk::__query_builder::IxCol<Profile, __sdk::Identity>,
|
||||
pub username: __sdk::__query_builder::IxCol<Profile, String>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for Profile {
|
||||
type IxCols = ProfileIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
ProfileIxCols {
|
||||
identity: __sdk::__query_builder::IxCol::new(table_name, "identity"),
|
||||
username: __sdk::__query_builder::IxCol::new(table_name, "username"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Profile {}
|
||||
192
packages/generated/src/spacetime/profiles_table.rs
Normal file
192
packages/generated/src/spacetime/profiles_table.rs
Normal 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_type::Profile;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `profiles`.
|
||||
///
|
||||
/// Obtain a handle from the [`ProfilesTableAccess::profiles`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.profiles()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.profiles().on_insert(...)`.
|
||||
pub struct ProfilesTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<Profile>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `profiles`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait ProfilesTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`ProfilesTableHandle`], which mediates access to the table `profiles`.
|
||||
fn profiles(&self) -> ProfilesTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl ProfilesTableAccess for super::RemoteTables {
|
||||
fn profiles(&self) -> ProfilesTableHandle<'_> {
|
||||
ProfilesTableHandle {
|
||||
imp: self.imp.get_table::<Profile>("profiles"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ProfilesInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct ProfilesDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for ProfilesTableHandle<'ctx> {
|
||||
type Row = Profile;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Profile> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = ProfilesInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ProfilesInsertCallbackId {
|
||||
ProfilesInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: ProfilesInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = ProfilesDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ProfilesDeleteCallbackId {
|
||||
ProfilesDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: ProfilesDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ProfilesUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for ProfilesTableHandle<'ctx> {
|
||||
type UpdateCallbackId = ProfilesUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> ProfilesUpdateCallbackId {
|
||||
ProfilesUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: ProfilesUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `identity` unique index on the table `profiles`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`ProfilesIdentityUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.profiles().identity().find(...)`.
|
||||
pub struct ProfilesIdentityUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Profile, __sdk::Identity>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> ProfilesTableHandle<'ctx> {
|
||||
/// Get a handle on the `identity` unique index on the table `profiles`.
|
||||
pub fn identity(&self) -> ProfilesIdentityUnique<'ctx> {
|
||||
ProfilesIdentityUnique {
|
||||
imp: self
|
||||
.imp
|
||||
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> ProfilesIdentityUnique<'ctx> {
|
||||
/// Find the subscribed row whose `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<Profile> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `username` unique index on the table `profiles`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`ProfilesUsernameUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.profiles().username().find(...)`.
|
||||
pub struct ProfilesUsernameUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Profile, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> ProfilesTableHandle<'ctx> {
|
||||
/// Get a handle on the `username` unique index on the table `profiles`.
|
||||
pub fn username(&self) -> ProfilesUsernameUnique<'ctx> {
|
||||
ProfilesUsernameUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("username"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> ProfilesUsernameUnique<'ctx> {
|
||||
/// Find the subscribed row whose `username` 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<Profile> {
|
||||
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::<Profile>("profiles");
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
_table.add_unique_constraint::<String>("username", |row| &row.username);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Profile>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Profile>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Profile`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait profilesQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `Profile`.
|
||||
fn profiles(&self) -> __sdk::__query_builder::Table<Profile>;
|
||||
}
|
||||
|
||||
impl profilesQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn profiles(&self) -> __sdk::__query_builder::Table<Profile> {
|
||||
__sdk::__query_builder::Table::new("profiles")
|
||||
}
|
||||
}
|
||||
70
packages/generated/src/spacetime/remove_activity_reducer.rs
Normal file
70
packages/generated/src/spacetime/remove_activity_reducer.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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::activity_type::Activity;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub(super) struct RemoveActivityArgs {
|
||||
pub activity: Activity,
|
||||
}
|
||||
|
||||
impl From<RemoveActivityArgs> for super::Reducer {
|
||||
fn from(args: RemoveActivityArgs) -> Self {
|
||||
Self::RemoveActivity {
|
||||
activity: args.activity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RemoveActivityArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `remove_activity`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait remove_activity {
|
||||
/// Request that the remote module invoke the reducer `remove_activity` 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 [`remove_activity:remove_activity_then`] to run a callback after the reducer completes.
|
||||
fn remove_activity(&self, activity: Activity) -> __sdk::Result<()> {
|
||||
self.remove_activity_then(activity, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `remove_activity` 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 remove_activity_then(
|
||||
&self,
|
||||
activity: Activity,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl remove_activity for super::RemoteReducers {
|
||||
fn remove_activity_then(
|
||||
&self,
|
||||
activity: Activity,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(RemoveActivityArgs { activity }, callback)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// 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(super) struct SetActivityNameArgs {
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl From<SetActivityNameArgs> for super::Reducer {
|
||||
fn from(args: SetActivityNameArgs) -> Self {
|
||||
Self::SetActivityName {
|
||||
id: args.id,
|
||||
name: args.name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for SetActivityNameArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `set_activity_name`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait set_activity_name {
|
||||
/// Request that the remote module invoke the reducer `set_activity_name` 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 [`set_activity_name:set_activity_name_then`] to run a callback after the reducer completes.
|
||||
fn set_activity_name(&self, id: u64, name: String) -> __sdk::Result<()> {
|
||||
self.set_activity_name_then(id, name, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `set_activity_name` 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 set_activity_name_then(
|
||||
&self,
|
||||
id: u64,
|
||||
name: String,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl set_activity_name for super::RemoteReducers {
|
||||
fn set_activity_name_then(
|
||||
&self,
|
||||
id: u64,
|
||||
name: String,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(SetActivityNameArgs { id, name }, callback)
|
||||
}
|
||||
}
|
||||
162
packages/generated/src/spacetime/task_part_table.rs
Normal file
162
packages/generated/src/spacetime/task_part_table.rs
Normal 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::action_type::Action;
|
||||
use super::task_part_type::TaskPart;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `task_part`.
|
||||
///
|
||||
/// Obtain a handle from the [`TaskPartTableAccess::task_part`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.task_part()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.task_part().on_insert(...)`.
|
||||
pub struct TaskPartTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<TaskPart>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `task_part`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait TaskPartTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`TaskPartTableHandle`], which mediates access to the table `task_part`.
|
||||
fn task_part(&self) -> TaskPartTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl TaskPartTableAccess for super::RemoteTables {
|
||||
fn task_part(&self) -> TaskPartTableHandle<'_> {
|
||||
TaskPartTableHandle {
|
||||
imp: self.imp.get_table::<TaskPart>("task_part"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TaskPartInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct TaskPartDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for TaskPartTableHandle<'ctx> {
|
||||
type Row = TaskPart;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = TaskPart> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = TaskPartInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TaskPartInsertCallbackId {
|
||||
TaskPartInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: TaskPartInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = TaskPartDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TaskPartDeleteCallbackId {
|
||||
TaskPartDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: TaskPartDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TaskPartUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for TaskPartTableHandle<'ctx> {
|
||||
type UpdateCallbackId = TaskPartUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> TaskPartUpdateCallbackId {
|
||||
TaskPartUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: TaskPartUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `identity` unique index on the table `task_part`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`TaskPartIdentityUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.task_part().identity().find(...)`.
|
||||
pub struct TaskPartIdentityUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<TaskPart, __sdk::Identity>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> TaskPartTableHandle<'ctx> {
|
||||
/// Get a handle on the `identity` unique index on the table `task_part`.
|
||||
pub fn identity(&self) -> TaskPartIdentityUnique<'ctx> {
|
||||
TaskPartIdentityUnique {
|
||||
imp: self
|
||||
.imp
|
||||
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> TaskPartIdentityUnique<'ctx> {
|
||||
/// Find the subscribed row whose `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<TaskPart> {
|
||||
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::<TaskPart>("task_part");
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<TaskPart>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<TaskPart>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `TaskPart`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait task_partQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `TaskPart`.
|
||||
fn task_part(&self) -> __sdk::__query_builder::Table<TaskPart>;
|
||||
}
|
||||
|
||||
impl task_partQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn task_part(&self) -> __sdk::__query_builder::Table<TaskPart> {
|
||||
__sdk::__query_builder::Table::new("task_part")
|
||||
}
|
||||
}
|
||||
60
packages/generated/src/spacetime/task_part_type.rs
Normal file
60
packages/generated/src/spacetime/task_part_type.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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::action_type::Action;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct TaskPart {
|
||||
pub identity: __sdk::Identity,
|
||||
pub start_of_current: __sdk::Timestamp,
|
||||
pub current: Action,
|
||||
pub upcoming: Vec<Action>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for TaskPart {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `TaskPart`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct TaskPartCols {
|
||||
pub identity: __sdk::__query_builder::Col<TaskPart, __sdk::Identity>,
|
||||
pub start_of_current: __sdk::__query_builder::Col<TaskPart, __sdk::Timestamp>,
|
||||
pub current: __sdk::__query_builder::Col<TaskPart, Action>,
|
||||
pub upcoming: __sdk::__query_builder::Col<TaskPart, Vec<Action>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for TaskPart {
|
||||
type Cols = TaskPartCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
TaskPartCols {
|
||||
identity: __sdk::__query_builder::Col::new(table_name, "identity"),
|
||||
start_of_current: __sdk::__query_builder::Col::new(table_name, "start_of_current"),
|
||||
current: __sdk::__query_builder::Col::new(table_name, "current"),
|
||||
upcoming: __sdk::__query_builder::Col::new(table_name, "upcoming"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `TaskPart`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct TaskPartIxCols {
|
||||
pub identity: __sdk::__query_builder::IxCol<TaskPart, __sdk::Identity>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for TaskPart {
|
||||
type IxCols = TaskPartIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
TaskPartIxCols {
|
||||
identity: __sdk::__query_builder::IxCol::new(table_name, "identity"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for TaskPart {}
|
||||
58
packages/generated/src/spacetime/task_type.rs
Normal file
58
packages/generated/src/spacetime/task_type.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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 Task {
|
||||
pub id: u64,
|
||||
pub done: bool,
|
||||
pub name: String,
|
||||
pub parent: Option<u64>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Task {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `Task`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct TaskCols {
|
||||
pub id: __sdk::__query_builder::Col<Task, u64>,
|
||||
pub done: __sdk::__query_builder::Col<Task, bool>,
|
||||
pub name: __sdk::__query_builder::Col<Task, String>,
|
||||
pub parent: __sdk::__query_builder::Col<Task, Option<u64>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Task {
|
||||
type Cols = TaskCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
TaskCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
done: __sdk::__query_builder::Col::new(table_name, "done"),
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
parent: __sdk::__query_builder::Col::new(table_name, "parent"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `Task`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct TaskIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<Task, u64>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for Task {
|
||||
type IxCols = TaskIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
TaskIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Task {}
|
||||
159
packages/generated/src/spacetime/tasks_table.rs
Normal file
159
packages/generated/src/spacetime/tasks_table.rs
Normal 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::task_type::Task;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `tasks`.
|
||||
///
|
||||
/// Obtain a handle from the [`TasksTableAccess::tasks`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.tasks()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.tasks().on_insert(...)`.
|
||||
pub struct TasksTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<Task>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `tasks`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait TasksTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`TasksTableHandle`], which mediates access to the table `tasks`.
|
||||
fn tasks(&self) -> TasksTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl TasksTableAccess for super::RemoteTables {
|
||||
fn tasks(&self) -> TasksTableHandle<'_> {
|
||||
TasksTableHandle {
|
||||
imp: self.imp.get_table::<Task>("tasks"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TasksInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct TasksDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for TasksTableHandle<'ctx> {
|
||||
type Row = Task;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Task> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = TasksInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TasksInsertCallbackId {
|
||||
TasksInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: TasksInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = TasksDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> TasksDeleteCallbackId {
|
||||
TasksDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: TasksDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TasksUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for TasksTableHandle<'ctx> {
|
||||
type UpdateCallbackId = TasksUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> TasksUpdateCallbackId {
|
||||
TasksUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: TasksUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `tasks`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`TasksIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.tasks().id().find(...)`.
|
||||
pub struct TasksIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Task, u64>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> TasksTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `tasks`.
|
||||
pub fn id(&self) -> TasksIdUnique<'ctx> {
|
||||
TasksIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u64>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> TasksIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &u64) -> Option<Task> {
|
||||
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::<Task>("tasks");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Task>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Task>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Task`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait tasksQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `Task`.
|
||||
fn tasks(&self) -> __sdk::__query_builder::Table<Task>;
|
||||
}
|
||||
|
||||
impl tasksQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn tasks(&self) -> __sdk::__query_builder::Table<Task> {
|
||||
__sdk::__query_builder::Table::new("tasks")
|
||||
}
|
||||
}
|
||||
70
packages/generated/src/spacetime/update_activity_reducer.rs
Normal file
70
packages/generated/src/spacetime/update_activity_reducer.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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::activity_type::Activity;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub(super) struct UpdateActivityArgs {
|
||||
pub activity: Activity,
|
||||
}
|
||||
|
||||
impl From<UpdateActivityArgs> for super::Reducer {
|
||||
fn from(args: UpdateActivityArgs) -> Self {
|
||||
Self::UpdateActivity {
|
||||
activity: args.activity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for UpdateActivityArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `update_activity`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait update_activity {
|
||||
/// Request that the remote module invoke the reducer `update_activity` 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 [`update_activity:update_activity_then`] to run a callback after the reducer completes.
|
||||
fn update_activity(&self, activity: Activity) -> __sdk::Result<()> {
|
||||
self.update_activity_then(activity, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `update_activity` 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 update_activity_then(
|
||||
&self,
|
||||
activity: Activity,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl update_activity for super::RemoteReducers {
|
||||
fn update_activity_then(
|
||||
&self,
|
||||
activity: Activity,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(UpdateActivityArgs { activity }, callback)
|
||||
}
|
||||
}
|
||||
70
packages/generated/src/spacetime/update_upcoming_reducer.rs
Normal file
70
packages/generated/src/spacetime/update_upcoming_reducer.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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::action_type::Action;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub(super) struct UpdateUpcomingArgs {
|
||||
pub upcoming: Vec<Action>,
|
||||
}
|
||||
|
||||
impl From<UpdateUpcomingArgs> for super::Reducer {
|
||||
fn from(args: UpdateUpcomingArgs) -> Self {
|
||||
Self::UpdateUpcoming {
|
||||
upcoming: args.upcoming,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for UpdateUpcomingArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `update_upcoming`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait update_upcoming {
|
||||
/// Request that the remote module invoke the reducer `update_upcoming` 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 [`update_upcoming:update_upcoming_then`] to run a callback after the reducer completes.
|
||||
fn update_upcoming(&self, upcoming: Vec<Action>) -> __sdk::Result<()> {
|
||||
self.update_upcoming_then(upcoming, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `update_upcoming` 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 update_upcoming_then(
|
||||
&self,
|
||||
upcoming: Vec<Action>,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl update_upcoming for super::RemoteReducers {
|
||||
fn update_upcoming_then(
|
||||
&self,
|
||||
upcoming: Vec<Action>,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(UpdateUpcomingArgs { upcoming }, callback)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user