pub trait BauData{
// Required methods
fn register_user_chat_id(
&self,
username: &str,
) -> impl Future<Output = Option<i64>> + Send;
fn insert_chat_id(
&self,
username: &str,
chat_id: i64,
) -> impl Future<Output = Result<Option<i64>, String>> + Send;
fn delete_chat_id(
&self,
username: &str,
) -> impl Future<Output = Result<i64, String>> + Send;
fn get_chat_id(
&self,
username: &str,
) -> impl Future<Output = Option<i64>> + Send;
fn is_admin(&self, username: &str) -> impl Future<Output = bool> + Send;
}
Expand description
Trait for database that crate::BauBot is able to interact with
Required Methods§
Sourcefn register_user_chat_id(
&self,
username: &str,
) -> impl Future<Output = Option<i64>> + Send
fn register_user_chat_id( &self, username: &str, ) -> impl Future<Output = Option<i64>> + Send
Get user’s chat_id from the DB based on the suppled username
.
Please remember that any String output gets parsed by crate::BauBot as a Html entity.
§Safety
The implementation of this trait should make all necessary authentication choices at the appropriate stages (e.g. verifying that the user is allowed to receive or send requests)
Sourcefn insert_chat_id(
&self,
username: &str,
chat_id: i64,
) -> impl Future<Output = Result<Option<i64>, String>> + Send
fn insert_chat_id( &self, username: &str, chat_id: i64, ) -> impl Future<Output = Result<Option<i64>, String>> + Send
Insert user’s username
into the DB together with their chat_id
.
Please remember that any String output gets parsed by crate::BauBot as a Html entity.
§Safety
The implementation of this trait should make all necessary authentication choices at the appropriate stages (e.g. verifying that the user is allowed to receive or send requests)
Sourcefn delete_chat_id(
&self,
username: &str,
) -> impl Future<Output = Result<i64, String>> + Send
fn delete_chat_id( &self, username: &str, ) -> impl Future<Output = Result<i64, String>> + Send
Delete user’s username
into the DB together with their chat_id
.
Please remember that any String output gets parsed by crate::BauBot as a Html entity.
§Safety
The implementation of this trait should make all necessary authentication choices at the appropriate stages (e.g. verifying that the user is allowed to receive or send requests)
Sourcefn get_chat_id(
&self,
username: &str,
) -> impl Future<Output = Option<i64>> + Send
fn get_chat_id( &self, username: &str, ) -> impl Future<Output = Option<i64>> + Send
Get chat_id for username
§Safety
The implementation of this trait should make all necessary authentication choices at the appropriate stages (e.g. verifying that the user is allowed to receive or send requests)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.