pub(super) struct Games {
pool: &'static Pool<Sqlite>,
}
Fields§
§pool: &'static Pool<Sqlite>
Implementations§
source§impl Games
impl Games
sourcepub(super) async fn init(pool: &'static Pool<Sqlite>) -> Result<Self>
pub(super) async fn init(pool: &'static Pool<Sqlite>) -> Result<Self>
This method sets up the database by creating required tables if they do not already exist.
It is supposed users were already setup.
sourcepub(super) async fn list(&self) -> Result<GameListing>
pub(super) async fn list(&self) -> Result<GameListing>
This method creates a new game in the DB and places all users to it.
sourcepub(super) async fn get(&self, game: &str) -> Result<Option<Game>>
pub(super) async fn get(&self, game: &str) -> Result<Option<Game>>
This method retrieves complete info about a single game.
sourcepub(super) async fn create(&self, game: Game) -> Result<(), CreationError>
pub(super) async fn create(&self, game: Game) -> Result<(), CreationError>
This method creates a new game in the DB and places all users to it.
pub(super) async fn add_player( &self, player: &GamePlayer, game: &str ) -> Result<(), AdditionError>
async fn add_player_inner<'c, E>(
executor: E,
author: bool,
player: &GamePlayer,
game: &str
) -> Result<(), AdditionError>where
E: SqliteExecutor<'c>,
sourcepub(super) async fn remove_player(
&self,
username: &str,
game: &str
) -> Result<(), RemovalError>
pub(super) async fn remove_player( &self, username: &str, game: &str ) -> Result<(), RemovalError>
Removes a player from a game. Deletes the game if the player was the game author.
async fn remove_player_inner<'c, E>(
executor: E,
username: &str,
game: &str
) -> Result<(), RemovalError>where
E: SqliteExecutor<'c>,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Games
impl !RefUnwindSafe for Games
impl Send for Games
impl Sync for Games
impl Unpin for Games
impl !UnwindSafe for Games
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more