mayhem_db/client/query/
common.rs

1use sea_orm::DbConn;
2use std::sync::Arc;
3
4pub enum UserQueryType {
5    FetchUser,
6    FetchUserServers,
7    FetchUserSettings,
8}
9
10pub enum ServerQueryType {
11    FetchServer,
12
13    FetchRoles,
14    FetchMembers,
15    FetchChannels,
16}
17
18pub trait ConnectionHolder {
19    /// Returns the internal database connection as a
20    /// reference to a [DbConn](sea_orm::DbConn) object.
21    /// This actually returns a case of the internal
22    /// [Arc](std::sync::Arc) reference, for ease of use.
23    fn get_connection(&self) -> &DbConn;
24
25    /// Returns the internal database connection. This
26    /// will return the [Arc](std::sync::Arc) reference
27    /// that contains the connection object or pool.
28    fn get_connection_ref(&self) -> Arc<DbConn>;
29
30    /// Returns a constant database connection. This is
31    /// to enforce memory safety because sea_orm's native
32    /// [DbConn](sea_orm::DbConn) does not implement
33    /// [Send](core::marker::Send) or [Sync](core::marker::Sync).
34    fn get_connection_raw(&self) -> *const DbConn;
35}