pub struct Database {
db: Database,
}Expand description
The database
Fields§
§db: DatabaseImplementations§
Source§impl Database
impl Database
Sourcepub async fn store_get<P, K, V>(&self, prefix: P, key: K) -> Result<Option<V>>
pub async fn store_get<P, K, V>(&self, prefix: P, key: K) -> Result<Option<V>>
Get a key from the store
Sourcepub async fn store_put<P, K, V>(
&self,
prefix: P,
key: K,
value: V,
) -> Result<()>
pub async fn store_put<P, K, V>( &self, prefix: P, key: K, value: V, ) -> Result<()>
Put a key in the store
Sourcepub async fn store_update<P, K, V, U>(
&self,
prefix: P,
key: K,
update_func: U,
) -> Result<()>
pub async fn store_update<P, K, V, U>( &self, prefix: P, key: K, update_func: U, ) -> Result<()>
Get and Put a key in the store in one action, ensuring the key is not changed between the commands.
Source§impl Database
impl Database
Sourcepub async fn create_tic_tac_toe_game(
&self,
guild_id: MaybeGuildString,
author: TicTacToePlayer,
author_team: Team,
opponent: TicTacToePlayer,
) -> Result<TicTacToeGame, TicTacToeCreateGameError>
pub async fn create_tic_tac_toe_game( &self, guild_id: MaybeGuildString, author: TicTacToePlayer, author_team: Team, opponent: TicTacToePlayer, ) -> Result<TicTacToeGame, TicTacToeCreateGameError>
Create a new tic-tac-toe game
Sourcepub async fn try_tic_tac_toe_move(
&self,
guild_id: MaybeGuildString,
player: TicTacToePlayer,
move_index: u8,
) -> Result<TicTacToeTryMoveResponse, TicTacToeTryMoveError>
pub async fn try_tic_tac_toe_move( &self, guild_id: MaybeGuildString, player: TicTacToePlayer, move_index: u8, ) -> Result<TicTacToeTryMoveResponse, TicTacToeTryMoveError>
Try to make a tic-tac-toe move
Sourcepub async fn get_tic_tac_toe_game(
&self,
guild_id: MaybeGuildString,
player: TicTacToePlayer,
) -> Result<Option<TicTacToeGame>>
pub async fn get_tic_tac_toe_game( &self, guild_id: MaybeGuildString, player: TicTacToePlayer, ) -> Result<Option<TicTacToeGame>>
Try to get a tic-tac-toe game by guild and player
Sourcepub async fn concede_tic_tac_toe_game(
&self,
guild_id: MaybeGuildString,
player: UserId,
) -> Result<Option<TicTacToeGame>>
pub async fn concede_tic_tac_toe_game( &self, guild_id: MaybeGuildString, player: UserId, ) -> Result<Option<TicTacToeGame>>
Sourcepub async fn get_tic_tac_toe_score(
&self,
guild_id: MaybeGuildString,
player: UserId,
) -> Result<TicTacToeScore>
pub async fn get_tic_tac_toe_score( &self, guild_id: MaybeGuildString, player: UserId, ) -> Result<TicTacToeScore>
Get the user’s Tic-Tac-Toe scores
Sourcepub async fn get_top_tic_tac_toe_scores(
&self,
guild_id: MaybeGuildString,
) -> Result<Vec<TicTacToeTopPlayerScore>>
pub async fn get_top_tic_tac_toe_scores( &self, guild_id: MaybeGuildString, ) -> Result<Vec<TicTacToeTopPlayerScore>>
Get the top Tic-Tac-Toe scores for the current server
Source§impl Database
impl Database
Sourcepub async fn set_tiktok_embed_flags(
&self,
guild_id: GuildId,
set_flags: TikTokEmbedFlags,
unset_flags: TikTokEmbedFlags,
) -> Result<(TikTokEmbedFlags, TikTokEmbedFlags)>
pub async fn set_tiktok_embed_flags( &self, guild_id: GuildId, set_flags: TikTokEmbedFlags, unset_flags: TikTokEmbedFlags, ) -> Result<(TikTokEmbedFlags, TikTokEmbedFlags)>
Set the flags for tiktok embeds.
§Returns
Returns the old flags and new flags in a tuple in that order.
Sourcepub async fn get_tiktok_embed_flags(
&self,
guild_id: GuildId,
) -> Result<TikTokEmbedFlags>
pub async fn get_tiktok_embed_flags( &self, guild_id: GuildId, ) -> Result<TikTokEmbedFlags>
Get the tiktok embed flags.
Source§impl Database
impl Database
Sourcepub async unsafe fn new<P>(path: P, create_if_missing: bool) -> Result<Self>where
P: Into<Utf8PathBuf>,
pub async unsafe fn new<P>(path: P, create_if_missing: bool) -> Result<Self>where
P: Into<Utf8PathBuf>,
§Safety
This must be called before any other sqlite functions are called.
Sourcepub unsafe fn blocking_new<P>(path: P, create_if_missing: bool) -> Result<Self>where
P: AsRef<Utf8Path>,
pub unsafe fn blocking_new<P>(path: P, create_if_missing: bool) -> Result<Self>where
P: AsRef<Utf8Path>,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnwindSafe for Database
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> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request