Document Rust binding recovery and remove temp snapshots
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use super::user_account_type::UserAccount;
|
||||
|
||||
/// Table handle for the table `user_account`.
|
||||
///
|
||||
/// Obtain a handle from the [`UserAccountTableAccess::user_account`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.user_account()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.user_account().on_insert(...)`.
|
||||
pub struct UserAccountTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<UserAccount>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `user_account`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait UserAccountTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`UserAccountTableHandle`], which mediates access to the table `user_account`.
|
||||
fn user_account(&self) -> UserAccountTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl UserAccountTableAccess for super::RemoteTables {
|
||||
fn user_account(&self) -> UserAccountTableHandle<'_> {
|
||||
UserAccountTableHandle {
|
||||
imp: self.imp.get_table::<UserAccount>("user_account"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct UserAccountInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct UserAccountDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for UserAccountTableHandle<'ctx> {
|
||||
type Row = UserAccount;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 { self.imp.count() }
|
||||
fn iter(&self) -> impl Iterator<Item = UserAccount> + '_ { self.imp.iter() }
|
||||
|
||||
type InsertCallbackId = UserAccountInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> UserAccountInsertCallbackId {
|
||||
UserAccountInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: UserAccountInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = UserAccountDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> UserAccountDeleteCallbackId {
|
||||
UserAccountDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: UserAccountDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct UserAccountUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for UserAccountTableHandle<'ctx> {
|
||||
type UpdateCallbackId = UserAccountUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> UserAccountUpdateCallbackId {
|
||||
UserAccountUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: UserAccountUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `user_id` unique index on the table `user_account`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`UserAccountUserIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.user_account().user_id().find(...)`.
|
||||
pub struct UserAccountUserIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<UserAccount, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> UserAccountTableHandle<'ctx> {
|
||||
/// Get a handle on the `user_id` unique index on the table `user_account`.
|
||||
pub fn user_id(&self) -> UserAccountUserIdUnique<'ctx> {
|
||||
UserAccountUserIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("user_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> UserAccountUserIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `user_id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<UserAccount> {
|
||||
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::<UserAccount>("user_account");
|
||||
_table.add_unique_constraint::<String>("user_id", |row| &row.user_id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<UserAccount>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse(
|
||||
"TableUpdate<UserAccount>",
|
||||
"TableUpdate",
|
||||
).with_cause(e).into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `UserAccount`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait user_accountQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `UserAccount`.
|
||||
fn user_account(&self) -> __sdk::__query_builder::Table<UserAccount>;
|
||||
}
|
||||
|
||||
impl user_accountQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn user_account(&self) -> __sdk::__query_builder::Table<UserAccount> {
|
||||
__sdk::__query_builder::Table::new("user_account")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user