codegen
This commit is contained in:
parent
d1446309c4
commit
d7b4221727
41 changed files with 893 additions and 1673 deletions
|
|
@ -2,13 +2,8 @@
|
|||
// 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::player_type::Player;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `player`.
|
||||
///
|
||||
|
|
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> {
|
|||
type Row = Player;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 { self.imp.count() }
|
||||
fn iter(&self) -> impl Iterator<Item = Player> + '_ { self.imp.iter() }
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = Player> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = PlayerInsertCallbackId;
|
||||
|
||||
|
|
@ -81,8 +80,7 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> {
|
|||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
|
||||
let _table = client_cache.get_or_make_table::<Player>("player");
|
||||
let _table = client_cache.get_or_make_table::<Player>("player");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||
}
|
||||
|
|
@ -103,76 +101,75 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse(
|
||||
"TableUpdate<Player>",
|
||||
"TableUpdate",
|
||||
).with_cause(e).into()
|
||||
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player().id().find(...)`.
|
||||
pub struct PlayerIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
/// Access to the `id` unique index on the table `player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player().id().find(...)`.
|
||||
pub struct PlayerIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `player`.
|
||||
pub fn id(&self) -> PlayerIdUnique<'ctx> {
|
||||
PlayerIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `player`.
|
||||
pub fn id(&self) -> PlayerIdUnique<'ctx> {
|
||||
PlayerIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerIdUnique<'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: &u32) -> Option<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `identity` unique index on the table `player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerIdentityUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player().identity().find(...)`.
|
||||
pub struct PlayerIdentityUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
impl<'ctx> PlayerIdUnique<'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: &u32) -> Option<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `identity` unique index on the table `player`.
|
||||
pub fn identity(&self) -> PlayerIdentityUnique<'ctx> {
|
||||
PlayerIdentityUnique {
|
||||
imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Access to the `identity` unique index on the table `player`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerIdentityUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player().identity().find(...)`.
|
||||
pub struct PlayerIdentityUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerIdentityUnique<'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<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||
/// Get a handle on the `identity` unique index on the table `player`.
|
||||
pub fn identity(&self) -> PlayerIdentityUnique<'ctx> {
|
||||
PlayerIdentityUnique {
|
||||
imp: self
|
||||
.imp
|
||||
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerIdentityUnique<'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<Player> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue