generate bindings
This commit is contained in:
parent
147f939179
commit
b66a4e63f1
22 changed files with 445 additions and 574 deletions
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#![allow(unused, clippy::all)]
|
||||
use super::bot_type::Bot;
|
||||
use super::db_tile_type::DbTile;
|
||||
use super::turn_state_type::TurnState;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `bot`.
|
||||
|
|
|
|||
|
|
@ -4,18 +4,12 @@
|
|||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::db_tile_type::DbTile;
|
||||
use super::turn_state_type::TurnState;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct Bot {
|
||||
pub id: u32,
|
||||
pub lobby_id: u32,
|
||||
pub turn_state: TurnState,
|
||||
pub hand: Vec<DbTile>,
|
||||
pub pond: Vec<DbTile>,
|
||||
pub working_tile: Option<DbTile>,
|
||||
pub config_id: u32,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Bot {
|
||||
|
|
@ -28,10 +22,7 @@ impl __sdk::InModule for Bot {
|
|||
pub struct BotCols {
|
||||
pub id: __sdk::__query_builder::Col<Bot, u32>,
|
||||
pub lobby_id: __sdk::__query_builder::Col<Bot, u32>,
|
||||
pub turn_state: __sdk::__query_builder::Col<Bot, TurnState>,
|
||||
pub hand: __sdk::__query_builder::Col<Bot, Vec<DbTile>>,
|
||||
pub pond: __sdk::__query_builder::Col<Bot, Vec<DbTile>>,
|
||||
pub working_tile: __sdk::__query_builder::Col<Bot, Option<DbTile>>,
|
||||
pub config_id: __sdk::__query_builder::Col<Bot, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Bot {
|
||||
|
|
@ -40,10 +31,7 @@ impl __sdk::__query_builder::HasCols for Bot {
|
|||
BotCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
turn_state: __sdk::__query_builder::Col::new(table_name, "turn_state"),
|
||||
hand: __sdk::__query_builder::Col::new(table_name, "hand"),
|
||||
pond: __sdk::__query_builder::Col::new(table_name, "pond"),
|
||||
working_tile: __sdk::__query_builder::Col::new(table_name, "working_tile"),
|
||||
config_id: __sdk::__query_builder::Col::new(table_name, "config_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
// 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 ClearAllArgs {}
|
||||
|
||||
impl From<ClearAllArgs> for super::Reducer {
|
||||
fn from(args: ClearAllArgs) -> Self {
|
||||
Self::ClearAll
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ClearAllArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the reducer `clear_all`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteReducers`].
|
||||
pub trait clear_all {
|
||||
/// Request that the remote module invoke the reducer `clear_all` 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 [`clear_all:clear_all_then`] to run a callback after the reducer completes.
|
||||
fn clear_all(&self) -> __sdk::Result<()> {
|
||||
self.clear_all_then(|_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `clear_all` 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 clear_all_then(
|
||||
&self,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()>;
|
||||
}
|
||||
|
||||
impl clear_all for super::RemoteReducers {
|
||||
fn clear_all_then(
|
||||
&self,
|
||||
|
||||
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(ClearAllArgs {}, callback)
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use super::game_timer_type::GameTimer;
|
||||
use super::lobby_timer_type::LobbyTimer;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `game_timer`.
|
||||
|
|
@ -14,7 +14,7 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.game_timer().on_insert(...)`.
|
||||
pub struct GameTimerTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<GameTimer>,
|
||||
imp: __sdk::TableHandle<LobbyTimer>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ pub trait GameTimerTableAccess {
|
|||
impl GameTimerTableAccess for super::RemoteTables {
|
||||
fn game_timer(&self) -> GameTimerTableHandle<'_> {
|
||||
GameTimerTableHandle {
|
||||
imp: self.imp.get_table::<GameTimer>("game_timer"),
|
||||
imp: self.imp.get_table::<LobbyTimer>("game_timer"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
|
@ -41,13 +41,13 @@ pub struct GameTimerInsertCallbackId(__sdk::CallbackId);
|
|||
pub struct GameTimerDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> {
|
||||
type Row = GameTimer;
|
||||
type Row = LobbyTimer;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = GameTimer> + '_ {
|
||||
fn iter(&self) -> impl Iterator<Item = LobbyTimer> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
|
|
@ -95,36 +95,6 @@ impl<'ctx> __sdk::TableWithPrimaryKey for GameTimerTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `game_timer`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`GameTimerIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.game_timer().id().find(...)`.
|
||||
pub struct GameTimerIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<GameTimer, u64>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> GameTimerTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `game_timer`.
|
||||
pub fn id(&self) -> GameTimerIdUnique<'ctx> {
|
||||
GameTimerIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u64>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> GameTimerIdUnique<'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<GameTimer> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `lobby_id` unique index on the table `game_timer`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`GameTimerLobbyIdUnique::find`] method.
|
||||
|
|
@ -133,7 +103,7 @@ impl<'ctx> GameTimerIdUnique<'ctx> {
|
|||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.game_timer().lobby_id().find(...)`.
|
||||
pub struct GameTimerLobbyIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<GameTimer, u32>,
|
||||
imp: __sdk::UniqueConstraintHandle<LobbyTimer, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
|
|
@ -150,41 +120,71 @@ impl<'ctx> GameTimerTableHandle<'ctx> {
|
|||
impl<'ctx> GameTimerLobbyIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `lobby_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<GameTimer> {
|
||||
pub fn find(&self, col_val: &u32) -> Option<LobbyTimer> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `scheduled_id` unique index on the table `game_timer`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`GameTimerScheduledIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.game_timer().scheduled_id().find(...)`.
|
||||
pub struct GameTimerScheduledIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<LobbyTimer, u64>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> GameTimerTableHandle<'ctx> {
|
||||
/// Get a handle on the `scheduled_id` unique index on the table `game_timer`.
|
||||
pub fn scheduled_id(&self) -> GameTimerScheduledIdUnique<'ctx> {
|
||||
GameTimerScheduledIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u64>("scheduled_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> GameTimerScheduledIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `scheduled_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<LobbyTimer> {
|
||||
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::<GameTimer>("game_timer");
|
||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||
let _table = client_cache.get_or_make_table::<LobbyTimer>("game_timer");
|
||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||
_table.add_unique_constraint::<u64>("scheduled_id", |row| &row.scheduled_id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<GameTimer>> {
|
||||
) -> __sdk::Result<__sdk::TableUpdate<LobbyTimer>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<GameTimer>", "TableUpdate")
|
||||
__sdk::InternalError::failed_parse("TableUpdate<LobbyTimer>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `GameTimer`.
|
||||
/// Extension trait for query builder access to the table `LobbyTimer`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait game_timerQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `GameTimer`.
|
||||
fn game_timer(&self) -> __sdk::__query_builder::Table<GameTimer>;
|
||||
/// Get a query builder for the table `LobbyTimer`.
|
||||
fn game_timer(&self) -> __sdk::__query_builder::Table<LobbyTimer>;
|
||||
}
|
||||
|
||||
impl game_timerQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn game_timer(&self) -> __sdk::__query_builder::Table<GameTimer> {
|
||||
fn game_timer(&self) -> __sdk::__query_builder::Table<LobbyTimer> {
|
||||
__sdk::__query_builder::Table::new("game_timer")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
// 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 GameTimer {
|
||||
pub id: u64,
|
||||
pub lobby_id: u32,
|
||||
pub scheduled_at: __sdk::ScheduleAt,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for GameTimer {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `GameTimer`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct GameTimerCols {
|
||||
pub id: __sdk::__query_builder::Col<GameTimer, u64>,
|
||||
pub lobby_id: __sdk::__query_builder::Col<GameTimer, u32>,
|
||||
pub scheduled_at: __sdk::__query_builder::Col<GameTimer, __sdk::ScheduleAt>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for GameTimer {
|
||||
type Cols = GameTimerCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
GameTimerCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
scheduled_at: __sdk::__query_builder::Col::new(table_name, "scheduled_at"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `GameTimer`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct GameTimerIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<GameTimer, u64>,
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<GameTimer, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for GameTimer {
|
||||
type IxCols = GameTimerIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
GameTimerIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for GameTimer {}
|
||||
|
|
@ -5,12 +5,11 @@
|
|||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::db_tile_type::DbTile;
|
||||
use super::player_or_bot_type::PlayerOrBot;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct HandView {
|
||||
pub player: PlayerOrBot,
|
||||
pub player_id: u32,
|
||||
pub hand_length: u8,
|
||||
pub pond: Vec<DbTile>,
|
||||
pub drawn: bool,
|
||||
|
|
@ -24,7 +23,7 @@ impl __sdk::InModule for HandView {
|
|||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct HandViewCols {
|
||||
pub player: __sdk::__query_builder::Col<HandView, PlayerOrBot>,
|
||||
pub player_id: __sdk::__query_builder::Col<HandView, u32>,
|
||||
pub hand_length: __sdk::__query_builder::Col<HandView, u8>,
|
||||
pub pond: __sdk::__query_builder::Col<HandView, Vec<DbTile>>,
|
||||
pub drawn: __sdk::__query_builder::Col<HandView, bool>,
|
||||
|
|
@ -34,7 +33,7 @@ impl __sdk::__query_builder::HasCols for HandView {
|
|||
type Cols = HandViewCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
HandViewCols {
|
||||
player: __sdk::__query_builder::Col::new(table_name, "player"),
|
||||
player_id: __sdk::__query_builder::Col::new(table_name, "player_id"),
|
||||
hand_length: __sdk::__query_builder::Col::new(table_name, "hand_length"),
|
||||
pond: __sdk::__query_builder::Col::new(table_name, "pond"),
|
||||
drawn: __sdk::__query_builder::Col::new(table_name, "drawn"),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#![allow(unused, clippy::all)]
|
||||
use super::game_state_type::GameState;
|
||||
use super::lobby_type::Lobby;
|
||||
use super::player_or_bot_type::PlayerOrBot;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `lobby`.
|
||||
|
|
|
|||
57
jong-db/src/db/lobby_timer_type.rs
Normal file
57
jong-db/src/db/lobby_timer_type.rs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// 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 LobbyTimer {
|
||||
pub lobby_id: u32,
|
||||
pub scheduled_id: u64,
|
||||
pub scheduled_at: __sdk::ScheduleAt,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for LobbyTimer {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `LobbyTimer`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct LobbyTimerCols {
|
||||
pub lobby_id: __sdk::__query_builder::Col<LobbyTimer, u32>,
|
||||
pub scheduled_id: __sdk::__query_builder::Col<LobbyTimer, u64>,
|
||||
pub scheduled_at: __sdk::__query_builder::Col<LobbyTimer, __sdk::ScheduleAt>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for LobbyTimer {
|
||||
type Cols = LobbyTimerCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
LobbyTimerCols {
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
scheduled_id: __sdk::__query_builder::Col::new(table_name, "scheduled_id"),
|
||||
scheduled_at: __sdk::__query_builder::Col::new(table_name, "scheduled_at"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `LobbyTimer`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct LobbyTimerIxCols {
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<LobbyTimer, u32>,
|
||||
pub scheduled_id: __sdk::__query_builder::IxCol<LobbyTimer, u64>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for LobbyTimer {
|
||||
type IxCols = LobbyTimerIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
LobbyTimerIxCols {
|
||||
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
|
||||
scheduled_id: __sdk::__query_builder::IxCol::new(table_name, "scheduled_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for LobbyTimer {}
|
||||
|
|
@ -5,13 +5,12 @@
|
|||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::game_state_type::GameState;
|
||||
use super::player_or_bot_type::PlayerOrBot;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct Lobby {
|
||||
pub id: u32,
|
||||
pub players: Vec<PlayerOrBot>,
|
||||
pub players: Vec<u32>,
|
||||
pub dealer_idx: u8,
|
||||
pub current_idx: u8,
|
||||
pub game_state: GameState,
|
||||
|
|
@ -26,7 +25,7 @@ impl __sdk::InModule for Lobby {
|
|||
/// Provides typed access to columns for query building.
|
||||
pub struct LobbyCols {
|
||||
pub id: __sdk::__query_builder::Col<Lobby, u32>,
|
||||
pub players: __sdk::__query_builder::Col<Lobby, Vec<PlayerOrBot>>,
|
||||
pub players: __sdk::__query_builder::Col<Lobby, Vec<u32>>,
|
||||
pub dealer_idx: __sdk::__query_builder::Col<Lobby, u8>,
|
||||
pub current_idx: __sdk::__query_builder::Col<Lobby, u8>,
|
||||
pub game_state: __sdk::__query_builder::Col<Lobby, GameState>,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.0.1 (commit a4d29daec8ed35ce4913a335b7210b9ae3933d00).
|
||||
// This was generated using spacetimedb cli version 2.0.2 (commit bc4fcec6f33f607fb46f61ae66c479eecf5a6e74).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
|
@ -10,62 +10,60 @@ pub mod add_bot_reducer;
|
|||
pub mod advance_game_reducer;
|
||||
pub mod bot_table;
|
||||
pub mod bot_type;
|
||||
pub mod clear_all_reducer;
|
||||
pub mod db_tile_type;
|
||||
pub mod db_wall_type;
|
||||
pub mod discard_tile_reducer;
|
||||
pub mod dragon_type;
|
||||
pub mod game_state_type;
|
||||
pub mod game_timer_table;
|
||||
pub mod game_timer_type;
|
||||
pub mod hand_view_type;
|
||||
pub mod join_or_create_lobby_reducer;
|
||||
pub mod lobby_table;
|
||||
pub mod lobby_timer_type;
|
||||
pub mod lobby_type;
|
||||
pub mod player_clock_table;
|
||||
pub mod player_clock_type;
|
||||
pub mod player_config_table;
|
||||
pub mod player_config_type;
|
||||
pub mod player_hand_type;
|
||||
pub mod player_or_bot_type;
|
||||
pub mod player_table;
|
||||
pub mod player_type;
|
||||
pub mod rank_type;
|
||||
pub mod set_ready_reducer;
|
||||
pub mod suit_type;
|
||||
pub mod tile_type;
|
||||
pub mod turn_state_type;
|
||||
pub mod user_type;
|
||||
pub mod view_closed_hands_table;
|
||||
pub mod view_hand_table;
|
||||
pub mod wall_type;
|
||||
pub mod wind_type;
|
||||
|
||||
pub use add_bot_reducer::add_bot;
|
||||
pub use advance_game_reducer::advance_game;
|
||||
pub use bot_table::*;
|
||||
pub use bot_type::Bot;
|
||||
pub use clear_all_reducer::clear_all;
|
||||
pub use db_tile_type::DbTile;
|
||||
pub use db_wall_type::DbWall;
|
||||
pub use discard_tile_reducer::discard_tile;
|
||||
pub use dragon_type::Dragon;
|
||||
pub use game_state_type::GameState;
|
||||
pub use game_timer_table::*;
|
||||
pub use game_timer_type::GameTimer;
|
||||
pub use hand_view_type::HandView;
|
||||
pub use join_or_create_lobby_reducer::join_or_create_lobby;
|
||||
pub use lobby_table::*;
|
||||
pub use lobby_timer_type::LobbyTimer;
|
||||
pub use lobby_type::Lobby;
|
||||
pub use player_clock_table::*;
|
||||
pub use player_clock_type::PlayerClock;
|
||||
pub use player_config_table::*;
|
||||
pub use player_config_type::PlayerConfig;
|
||||
pub use player_hand_type::PlayerHand;
|
||||
pub use player_or_bot_type::PlayerOrBot;
|
||||
pub use player_table::*;
|
||||
pub use player_type::Player;
|
||||
pub use rank_type::Rank;
|
||||
pub use set_ready_reducer::set_ready;
|
||||
pub use suit_type::Suit;
|
||||
pub use tile_type::Tile;
|
||||
pub use turn_state_type::TurnState;
|
||||
pub use user_type::User;
|
||||
pub use view_closed_hands_table::*;
|
||||
pub use view_hand_table::*;
|
||||
pub use wall_type::Wall;
|
||||
pub use wind_type::Wind;
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
|
|
@ -78,7 +76,6 @@ pub use wind_type::Wind;
|
|||
pub enum Reducer {
|
||||
AddBot { lobby_id: u32 },
|
||||
AdvanceGame,
|
||||
ClearAll,
|
||||
DiscardTile { tile_id: u32 },
|
||||
JoinOrCreateLobby { lobby_id: u32 },
|
||||
SetReady { ready: bool },
|
||||
|
|
@ -93,7 +90,6 @@ impl __sdk::Reducer for Reducer {
|
|||
match self {
|
||||
Reducer::AddBot { .. } => "add_bot",
|
||||
Reducer::AdvanceGame => "advance_game",
|
||||
Reducer::ClearAll => "clear_all",
|
||||
Reducer::DiscardTile { .. } => "discard_tile",
|
||||
Reducer::JoinOrCreateLobby { .. } => "join_or_create_lobby",
|
||||
Reducer::SetReady { .. } => "set_ready",
|
||||
|
|
@ -109,7 +105,6 @@ impl __sdk::Reducer for Reducer {
|
|||
Reducer::AdvanceGame => {
|
||||
__sats::bsatn::to_vec(&advance_game_reducer::AdvanceGameArgs {})
|
||||
}
|
||||
Reducer::ClearAll => __sats::bsatn::to_vec(&clear_all_reducer::ClearAllArgs {}),
|
||||
Reducer::DiscardTile { tile_id } => {
|
||||
__sats::bsatn::to_vec(&discard_tile_reducer::DiscardTileArgs {
|
||||
tile_id: tile_id.clone(),
|
||||
|
|
@ -135,10 +130,10 @@ impl __sdk::Reducer for Reducer {
|
|||
#[doc(hidden)]
|
||||
pub struct DbUpdate {
|
||||
bot: __sdk::TableUpdate<Bot>,
|
||||
game_timer: __sdk::TableUpdate<GameTimer>,
|
||||
game_timer: __sdk::TableUpdate<LobbyTimer>,
|
||||
lobby: __sdk::TableUpdate<Lobby>,
|
||||
player: __sdk::TableUpdate<Player>,
|
||||
player_clock: __sdk::TableUpdate<PlayerClock>,
|
||||
player_config: __sdk::TableUpdate<PlayerConfig>,
|
||||
view_closed_hands: __sdk::TableUpdate<HandView>,
|
||||
view_hand: __sdk::TableUpdate<PlayerHand>,
|
||||
}
|
||||
|
|
@ -158,12 +153,12 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
|
|||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(lobby_table::parse_table_update(table_update)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(player_table::parse_table_update(table_update)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(player_clock_table::parse_table_update(table_update)?),
|
||||
"player_config" => db_update
|
||||
.player_config
|
||||
.append(player_config_table::parse_table_update(table_update)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(view_closed_hands_table::parse_table_update(table_update)?),
|
||||
|
|
@ -200,16 +195,16 @@ impl __sdk::DbUpdate for DbUpdate {
|
|||
.apply_diff_to_table::<Bot>("bot", &self.bot)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.game_timer = cache
|
||||
.apply_diff_to_table::<GameTimer>("game_timer", &self.game_timer)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
.apply_diff_to_table::<LobbyTimer>("game_timer", &self.game_timer)
|
||||
.with_updates_by_pk(|row| &row.scheduled_id);
|
||||
diff.lobby = cache
|
||||
.apply_diff_to_table::<Lobby>("lobby", &self.lobby)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.player = cache
|
||||
.apply_diff_to_table::<Player>("player", &self.player)
|
||||
.with_updates_by_pk(|row| &row.identity);
|
||||
diff.player_clock = cache
|
||||
.apply_diff_to_table::<PlayerClock>("player_clock", &self.player_clock)
|
||||
.with_updates_by_pk(|row| &row.player_id);
|
||||
diff.player_config = cache
|
||||
.apply_diff_to_table::<PlayerConfig>("player_config", &self.player_config)
|
||||
.with_updates_by_pk(|row| &row.id);
|
||||
diff.view_closed_hands =
|
||||
cache.apply_diff_to_table::<HandView>("view_closed_hands", &self.view_closed_hands);
|
||||
|
|
@ -230,12 +225,12 @@ impl __sdk::DbUpdate for DbUpdate {
|
|||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"player_config" => db_update
|
||||
.player_config
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
|
|
@ -264,12 +259,12 @@ impl __sdk::DbUpdate for DbUpdate {
|
|||
"lobby" => db_update
|
||||
.lobby
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"player" => db_update
|
||||
.player
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"player_clock" => db_update
|
||||
.player_clock
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"player_config" => db_update
|
||||
.player_config
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"view_closed_hands" => db_update
|
||||
.view_closed_hands
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
|
|
@ -292,10 +287,10 @@ impl __sdk::DbUpdate for DbUpdate {
|
|||
#[doc(hidden)]
|
||||
pub struct AppliedDiff<'r> {
|
||||
bot: __sdk::TableAppliedDiff<'r, Bot>,
|
||||
game_timer: __sdk::TableAppliedDiff<'r, GameTimer>,
|
||||
game_timer: __sdk::TableAppliedDiff<'r, LobbyTimer>,
|
||||
lobby: __sdk::TableAppliedDiff<'r, Lobby>,
|
||||
player: __sdk::TableAppliedDiff<'r, Player>,
|
||||
player_clock: __sdk::TableAppliedDiff<'r, PlayerClock>,
|
||||
player_config: __sdk::TableAppliedDiff<'r, PlayerConfig>,
|
||||
view_closed_hands: __sdk::TableAppliedDiff<'r, HandView>,
|
||||
view_hand: __sdk::TableAppliedDiff<'r, PlayerHand>,
|
||||
__unused: std::marker::PhantomData<&'r ()>,
|
||||
|
|
@ -312,14 +307,18 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
|||
callbacks: &mut __sdk::DbCallbacks<RemoteModule>,
|
||||
) {
|
||||
callbacks.invoke_table_row_callbacks::<Bot>("bot", &self.bot, event);
|
||||
callbacks.invoke_table_row_callbacks::<GameTimer>("game_timer", &self.game_timer, event);
|
||||
callbacks.invoke_table_row_callbacks::<LobbyTimer>("game_timer", &self.game_timer, event);
|
||||
callbacks.invoke_table_row_callbacks::<Lobby>("lobby", &self.lobby, event);
|
||||
callbacks.invoke_table_row_callbacks::<Player>("player", &self.player, event);
|
||||
callbacks.invoke_table_row_callbacks::<PlayerClock>(
|
||||
"player_clock",
|
||||
&self.player_clock,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<PlayerConfig>(
|
||||
"player_config",
|
||||
&self.player_config,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<HandView>(
|
||||
"view_closed_hands",
|
||||
&self.view_closed_hands,
|
||||
|
|
@ -973,8 +972,8 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
|||
bot_table::register_table(client_cache);
|
||||
game_timer_table::register_table(client_cache);
|
||||
lobby_table::register_table(client_cache);
|
||||
player_table::register_table(client_cache);
|
||||
player_clock_table::register_table(client_cache);
|
||||
player_config_table::register_table(client_cache);
|
||||
view_closed_hands_table::register_table(client_cache);
|
||||
view_hand_table::register_table(client_cache);
|
||||
}
|
||||
|
|
@ -982,8 +981,8 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
|||
"bot",
|
||||
"game_timer",
|
||||
"lobby",
|
||||
"player",
|
||||
"player_clock",
|
||||
"player_config",
|
||||
"view_closed_hands",
|
||||
"view_hand",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -95,36 +95,6 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerClockTableHandle<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `player_clock`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerClockIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_clock().id().find(...)`.
|
||||
pub struct PlayerClockIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<PlayerClock, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerClockTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `player_clock`.
|
||||
pub fn id(&self) -> PlayerClockIdUnique<'ctx> {
|
||||
PlayerClockIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerClockIdUnique<'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<PlayerClock> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `player_id` unique index on the table `player_clock`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerClockPlayerIdUnique::find`] method.
|
||||
|
|
@ -158,7 +128,6 @@ impl<'ctx> PlayerClockPlayerIdUnique<'ctx> {
|
|||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<PlayerClock>("player_clock");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ 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 PlayerClock {
|
||||
pub id: u32,
|
||||
pub player_id: u32,
|
||||
pub renewable: u16,
|
||||
pub total: u16,
|
||||
|
|
@ -21,7 +20,6 @@ impl __sdk::InModule for PlayerClock {
|
|||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct PlayerClockCols {
|
||||
pub id: __sdk::__query_builder::Col<PlayerClock, u32>,
|
||||
pub player_id: __sdk::__query_builder::Col<PlayerClock, u32>,
|
||||
pub renewable: __sdk::__query_builder::Col<PlayerClock, u16>,
|
||||
pub total: __sdk::__query_builder::Col<PlayerClock, u16>,
|
||||
|
|
@ -31,7 +29,6 @@ impl __sdk::__query_builder::HasCols for PlayerClock {
|
|||
type Cols = PlayerClockCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
PlayerClockCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
player_id: __sdk::__query_builder::Col::new(table_name, "player_id"),
|
||||
renewable: __sdk::__query_builder::Col::new(table_name, "renewable"),
|
||||
total: __sdk::__query_builder::Col::new(table_name, "total"),
|
||||
|
|
@ -43,7 +40,6 @@ impl __sdk::__query_builder::HasCols for PlayerClock {
|
|||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct PlayerClockIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<PlayerClock, u32>,
|
||||
pub player_id: __sdk::__query_builder::IxCol<PlayerClock, u32>,
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +47,6 @@ impl __sdk::__query_builder::HasIxCols for PlayerClock {
|
|||
type IxCols = PlayerClockIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
PlayerClockIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
player_id: __sdk::__query_builder::IxCol::new(table_name, "player_id"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
159
jong-db/src/db/player_config_table.rs
Normal file
159
jong-db/src/db/player_config_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::player_config_type::PlayerConfig;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `player_config`.
|
||||
///
|
||||
/// Obtain a handle from the [`PlayerConfigTableAccess::player_config`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.player_config()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_config().on_insert(...)`.
|
||||
pub struct PlayerConfigTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<PlayerConfig>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `player_config`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait PlayerConfigTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`PlayerConfigTableHandle`], which mediates access to the table `player_config`.
|
||||
fn player_config(&self) -> PlayerConfigTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl PlayerConfigTableAccess for super::RemoteTables {
|
||||
fn player_config(&self) -> PlayerConfigTableHandle<'_> {
|
||||
PlayerConfigTableHandle {
|
||||
imp: self.imp.get_table::<PlayerConfig>("player_config"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerConfigInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct PlayerConfigDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for PlayerConfigTableHandle<'ctx> {
|
||||
type Row = PlayerConfig;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = PlayerConfig> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = PlayerConfigInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerConfigInsertCallbackId {
|
||||
PlayerConfigInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: PlayerConfigInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = PlayerConfigDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerConfigDeleteCallbackId {
|
||||
PlayerConfigDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: PlayerConfigDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerConfigUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerConfigTableHandle<'ctx> {
|
||||
type UpdateCallbackId = PlayerConfigUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> PlayerConfigUpdateCallbackId {
|
||||
PlayerConfigUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: PlayerConfigUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `id` unique index on the table `player_config`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PlayerConfigIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player_config().id().find(...)`.
|
||||
pub struct PlayerConfigIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<PlayerConfig, u32>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerConfigTableHandle<'ctx> {
|
||||
/// Get a handle on the `id` unique index on the table `player_config`.
|
||||
pub fn id(&self) -> PlayerConfigIdUnique<'ctx> {
|
||||
PlayerConfigIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<u32>("id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PlayerConfigIdUnique<'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<PlayerConfig> {
|
||||
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::<PlayerConfig>("player_config");
|
||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<PlayerConfig>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<PlayerConfig>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `PlayerConfig`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait player_configQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `PlayerConfig`.
|
||||
fn player_config(&self) -> __sdk::__query_builder::Table<PlayerConfig>;
|
||||
}
|
||||
|
||||
impl player_configQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn player_config(&self) -> __sdk::__query_builder::Table<PlayerConfig> {
|
||||
__sdk::__query_builder::Table::new("player_config")
|
||||
}
|
||||
}
|
||||
58
jong-db/src/db/player_config_type.rs
Normal file
58
jong-db/src/db/player_config_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 PlayerConfig {
|
||||
pub id: u32,
|
||||
pub name: String,
|
||||
pub ready: bool,
|
||||
pub sort: bool,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PlayerConfig {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `PlayerConfig`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct PlayerConfigCols {
|
||||
pub id: __sdk::__query_builder::Col<PlayerConfig, u32>,
|
||||
pub name: __sdk::__query_builder::Col<PlayerConfig, String>,
|
||||
pub ready: __sdk::__query_builder::Col<PlayerConfig, bool>,
|
||||
pub sort: __sdk::__query_builder::Col<PlayerConfig, bool>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for PlayerConfig {
|
||||
type Cols = PlayerConfigCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
PlayerConfigCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
ready: __sdk::__query_builder::Col::new(table_name, "ready"),
|
||||
sort: __sdk::__query_builder::Col::new(table_name, "sort"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `PlayerConfig`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct PlayerConfigIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<PlayerConfig, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for PlayerConfig {
|
||||
type IxCols = PlayerConfigIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
PlayerConfigIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for PlayerConfig {}
|
||||
|
|
@ -10,11 +10,10 @@ use super::turn_state_type::TurnState;
|
|||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct PlayerHand {
|
||||
pub id: u32,
|
||||
pub player_id: u32,
|
||||
pub turn_state: TurnState,
|
||||
pub pond: Vec<DbTile>,
|
||||
pub hand: Vec<DbTile>,
|
||||
pub pond: Vec<DbTile>,
|
||||
pub working_tile: Option<DbTile>,
|
||||
}
|
||||
|
||||
|
|
@ -26,11 +25,10 @@ impl __sdk::InModule for PlayerHand {
|
|||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct PlayerHandCols {
|
||||
pub id: __sdk::__query_builder::Col<PlayerHand, u32>,
|
||||
pub player_id: __sdk::__query_builder::Col<PlayerHand, u32>,
|
||||
pub turn_state: __sdk::__query_builder::Col<PlayerHand, TurnState>,
|
||||
pub pond: __sdk::__query_builder::Col<PlayerHand, Vec<DbTile>>,
|
||||
pub hand: __sdk::__query_builder::Col<PlayerHand, Vec<DbTile>>,
|
||||
pub pond: __sdk::__query_builder::Col<PlayerHand, Vec<DbTile>>,
|
||||
pub working_tile: __sdk::__query_builder::Col<PlayerHand, Option<DbTile>>,
|
||||
}
|
||||
|
||||
|
|
@ -38,11 +36,10 @@ impl __sdk::__query_builder::HasCols for PlayerHand {
|
|||
type Cols = PlayerHandCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
PlayerHandCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
player_id: __sdk::__query_builder::Col::new(table_name, "player_id"),
|
||||
turn_state: __sdk::__query_builder::Col::new(table_name, "turn_state"),
|
||||
pond: __sdk::__query_builder::Col::new(table_name, "pond"),
|
||||
hand: __sdk::__query_builder::Col::new(table_name, "hand"),
|
||||
pond: __sdk::__query_builder::Col::new(table_name, "pond"),
|
||||
working_tile: __sdk::__query_builder::Col::new(table_name, "working_tile"),
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +49,6 @@ impl __sdk::__query_builder::HasCols for PlayerHand {
|
|||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct PlayerHandIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<PlayerHand, u32>,
|
||||
pub player_id: __sdk::__query_builder::IxCol<PlayerHand, u32>,
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +56,6 @@ impl __sdk::__query_builder::HasIxCols for PlayerHand {
|
|||
type IxCols = PlayerHandIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
PlayerHandIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
player_id: __sdk::__query_builder::IxCol::new(table_name, "player_id"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
// 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 enum PlayerOrBot {
|
||||
Player(u32),
|
||||
|
||||
Bot(u32),
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PlayerOrBot {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use super::player_type::Player;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `player`.
|
||||
///
|
||||
/// Obtain a handle from the [`PlayerTableAccess::player`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.player()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.player().on_insert(...)`.
|
||||
pub struct PlayerTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<Player>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `player`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait PlayerTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`PlayerTableHandle`], which mediates access to the table `player`.
|
||||
fn player(&self) -> PlayerTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl PlayerTableAccess for super::RemoteTables {
|
||||
fn player(&self) -> PlayerTableHandle<'_> {
|
||||
PlayerTableHandle {
|
||||
imp: self.imp.get_table::<Player>("player"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct PlayerDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
type InsertCallbackId = PlayerInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerInsertCallbackId {
|
||||
PlayerInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: PlayerInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = PlayerDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PlayerDeleteCallbackId {
|
||||
PlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: PlayerDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> {
|
||||
type UpdateCallbackId = PlayerUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> PlayerUpdateCallbackId {
|
||||
PlayerUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: PlayerUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// 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> 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> 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)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
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);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __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()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `Player`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait playerQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `Player`.
|
||||
fn player(&self) -> __sdk::__query_builder::Table<Player>;
|
||||
}
|
||||
|
||||
impl playerQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn player(&self) -> __sdk::__query_builder::Table<Player> {
|
||||
__sdk::__query_builder::Table::new("player")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// 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 Player {
|
||||
pub id: u32,
|
||||
pub identity: __sdk::Identity,
|
||||
pub name: Option<String>,
|
||||
pub lobby_id: u32,
|
||||
pub ready: bool,
|
||||
pub sort: bool,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Player {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `Player`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct PlayerCols {
|
||||
pub id: __sdk::__query_builder::Col<Player, u32>,
|
||||
pub identity: __sdk::__query_builder::Col<Player, __sdk::Identity>,
|
||||
pub name: __sdk::__query_builder::Col<Player, Option<String>>,
|
||||
pub lobby_id: __sdk::__query_builder::Col<Player, u32>,
|
||||
pub ready: __sdk::__query_builder::Col<Player, bool>,
|
||||
pub sort: __sdk::__query_builder::Col<Player, bool>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Player {
|
||||
type Cols = PlayerCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
PlayerCols {
|
||||
id: __sdk::__query_builder::Col::new(table_name, "id"),
|
||||
identity: __sdk::__query_builder::Col::new(table_name, "identity"),
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
ready: __sdk::__query_builder::Col::new(table_name, "ready"),
|
||||
sort: __sdk::__query_builder::Col::new(table_name, "sort"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `Player`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct PlayerIxCols {
|
||||
pub id: __sdk::__query_builder::IxCol<Player, u32>,
|
||||
pub identity: __sdk::__query_builder::IxCol<Player, __sdk::Identity>,
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<Player, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for Player {
|
||||
type IxCols = PlayerIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
PlayerIxCols {
|
||||
id: __sdk::__query_builder::IxCol::new(table_name, "id"),
|
||||
identity: __sdk::__query_builder::IxCol::new(table_name, "identity"),
|
||||
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Player {}
|
||||
62
jong-db/src/db/user_type.rs
Normal file
62
jong-db/src/db/user_type.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 struct User {
|
||||
pub identity: __sdk::Identity,
|
||||
pub name: String,
|
||||
pub lobby_id: u32,
|
||||
pub config_id: u32,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for User {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `User`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct UserCols {
|
||||
pub identity: __sdk::__query_builder::Col<User, __sdk::Identity>,
|
||||
pub name: __sdk::__query_builder::Col<User, String>,
|
||||
pub lobby_id: __sdk::__query_builder::Col<User, u32>,
|
||||
pub config_id: __sdk::__query_builder::Col<User, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for User {
|
||||
type Cols = UserCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
UserCols {
|
||||
identity: __sdk::__query_builder::Col::new(table_name, "identity"),
|
||||
name: __sdk::__query_builder::Col::new(table_name, "name"),
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
config_id: __sdk::__query_builder::Col::new(table_name, "config_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `User`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct UserIxCols {
|
||||
pub config_id: __sdk::__query_builder::IxCol<User, u32>,
|
||||
pub identity: __sdk::__query_builder::IxCol<User, __sdk::Identity>,
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<User, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for User {
|
||||
type IxCols = UserIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
UserIxCols {
|
||||
config_id: __sdk::__query_builder::IxCol::new(table_name, "config_id"),
|
||||
identity: __sdk::__query_builder::IxCol::new(table_name, "identity"),
|
||||
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for User {}
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
#![allow(unused, clippy::all)]
|
||||
use super::db_tile_type::DbTile;
|
||||
use super::hand_view_type::HandView;
|
||||
use super::player_or_bot_type::PlayerOrBot;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `view_closed_hands`.
|
||||
|
|
|
|||
|
|
@ -8,47 +8,47 @@ use super::db_tile_type::DbTile;
|
|||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct DbWall {
|
||||
pub struct Wall {
|
||||
pub lobby_id: u32,
|
||||
pub tiles: Vec<DbTile>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for DbWall {
|
||||
impl __sdk::InModule for Wall {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `DbWall`.
|
||||
/// Column accessor struct for the table `Wall`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct DbWallCols {
|
||||
pub lobby_id: __sdk::__query_builder::Col<DbWall, u32>,
|
||||
pub tiles: __sdk::__query_builder::Col<DbWall, Vec<DbTile>>,
|
||||
pub struct WallCols {
|
||||
pub lobby_id: __sdk::__query_builder::Col<Wall, u32>,
|
||||
pub tiles: __sdk::__query_builder::Col<Wall, Vec<DbTile>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for DbWall {
|
||||
type Cols = DbWallCols;
|
||||
impl __sdk::__query_builder::HasCols for Wall {
|
||||
type Cols = WallCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
DbWallCols {
|
||||
WallCols {
|
||||
lobby_id: __sdk::__query_builder::Col::new(table_name, "lobby_id"),
|
||||
tiles: __sdk::__query_builder::Col::new(table_name, "tiles"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `DbWall`.
|
||||
/// Indexed column accessor struct for the table `Wall`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct DbWallIxCols {
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<DbWall, u32>,
|
||||
pub struct WallIxCols {
|
||||
pub lobby_id: __sdk::__query_builder::IxCol<Wall, u32>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for DbWall {
|
||||
type IxCols = DbWallIxCols;
|
||||
impl __sdk::__query_builder::HasIxCols for Wall {
|
||||
type IxCols = WallIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
DbWallIxCols {
|
||||
WallIxCols {
|
||||
lobby_id: __sdk::__query_builder::IxCol::new(table_name, "lobby_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for DbWall {}
|
||||
impl __sdk::__query_builder::CanBeLookupTable for Wall {}
|
||||
|
|
@ -55,13 +55,4 @@ mod conversions {
|
|||
Self::from_repr(value as usize).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&crate::db::PlayerOrBot> for jong_types::PlayerOrBot {
|
||||
fn from(value: &crate::db::PlayerOrBot) -> Self {
|
||||
match value {
|
||||
crate::PlayerOrBot::Player(id) => Self::Player { id: *id },
|
||||
crate::PlayerOrBot::Bot(id) => Self::Bot { id: *id },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue