pub struct Interaction {
pub id: String,
pub interaction_type: InteractionType,
pub player: String,
pub target: Option<String>,
pub date: Option<NaiveDateTime>,
}Expand description
Interaction between players.
The type of interaction determines the nature of the interaction. It can be a Hunt, Feed, Cure, Corpsify, or any other type of interaction.
Fields§
§id: String§interaction_type: InteractionType§player: String§target: Option<String>§date: Option<NaiveDateTime>Implementations§
Source§impl Interaction
impl Interaction
Sourcepub fn new(
interaction_type: InteractionType,
player: String,
target: Option<String>,
) -> Self
pub fn new( interaction_type: InteractionType, player: String, target: Option<String>, ) -> Self
Creates a new interaction.
§Arguments
interaction_type- The type of interaction.player_id- The ID of the player.target_id- The ID of the target player.feed1_id- The ID of the first feed.feed2_id- The ID of the second feed.message- The message of the interaction.
§Returns
A new interaction.
Sourcepub async fn save_hunt_interaction(
player: &Player,
target: &Player,
feed1: Option<&Player>,
feed2: Option<&Player>,
) -> Result<(), String>
pub async fn save_hunt_interaction( player: &Player, target: &Player, feed1: Option<&Player>, feed2: Option<&Player>, ) -> Result<(), String>
Save a hunt interaction.
This function saves a hunt interaction between a player and a target. It also saves feed interactions between the player and the target’s feeders.
§Arguments
player- The player who initiated the hunt.target- The player who was hunted.feed1- The first feeder of the target.feed2- The second feeder of the target.
§Returns
A Result indicating success or failure.
Sourcepub async fn get_newest_interactions() -> Result<Vec<Interaction>, String>
pub async fn get_newest_interactions() -> Result<Vec<Interaction>, String>
This function is used to get the newest interactions:
§Returns
A vector of interactions sorted by ID in descending order.
Sourcepub async fn get_all_interactions() -> Result<Vec<InteractionReturnType>, String>
pub async fn get_all_interactions() -> Result<Vec<InteractionReturnType>, String>
This function is used to get all interactions
Z0 is returned as anonymous
§Returns
A vector of interactions sorted by ID in descending order.
Sourcepub async fn get_hunt_interactions() -> Result<Vec<Interaction>, String>
pub async fn get_hunt_interactions() -> Result<Vec<Interaction>, String>
Get all interactions related to hunting.
Used in leaderboards and zombie tree
§Returns
A vector of hunt interactions
Sourcepub async fn get_leaderboard(
is_zombie: bool,
) -> Result<Vec<LeaderBoardPlayers>, String>
pub async fn get_leaderboard( is_zombie: bool, ) -> Result<Vec<LeaderBoardPlayers>, String>
Get leaderboard data
This represents the zombie list and their kills, ordered by the number of kills, from most to least.
Z0 is returned as anonymous
§Returns
A vector of LeaderBoardPlayers, sorted by the number of kills in descending order.
Sourcepub async fn get_zombie_tree() -> Result<(Vec<ZombieTree>, HashMap<String, (PlayerState, PlayerRole)>), String>
pub async fn get_zombie_tree() -> Result<(Vec<ZombieTree>, HashMap<String, (PlayerState, PlayerRole)>), String>
Trait Implementations§
Source§impl Clone for Interaction
impl Clone for Interaction
Source§fn clone(&self) -> Interaction
fn clone(&self) -> Interaction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Interaction
impl Debug for Interaction
Source§impl<'de> Deserialize<'de> for Interaction
impl<'de> Deserialize<'de> for Interaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Insertable<table> for Interactionwhere
String: AsExpression<<id as Expression>::SqlType> + AsExpression<<player as Expression>::SqlType> + AsExpression<<target as Expression>::SqlType>,
InteractionType: AsExpression<<interaction_type as Expression>::SqlType>,
NaiveDateTime: AsExpression<<date as Expression>::SqlType>,
impl Insertable<table> for Interactionwhere
String: AsExpression<<id as Expression>::SqlType> + AsExpression<<player as Expression>::SqlType> + AsExpression<<target as Expression>::SqlType>,
InteractionType: AsExpression<<interaction_type as Expression>::SqlType>,
NaiveDateTime: AsExpression<<date as Expression>::SqlType>,
Source§type Values = <(Option<Grouped<Eq<id, <String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<interaction_type, <InteractionType as AsExpression<<interaction_type as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player, <String as AsExpression<<player as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<target, <String as AsExpression<<target as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<date, <NaiveDateTime as AsExpression<<date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
type Values = <(Option<Grouped<Eq<id, <String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<interaction_type, <InteractionType as AsExpression<<interaction_type as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player, <String as AsExpression<<player as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<target, <String as AsExpression<<target as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<date, <NaiveDateTime as AsExpression<<date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
VALUES clause to insert these records Read moreSource§fn values(
self,
) -> <(Option<Eq<id, String>>, Option<Eq<interaction_type, InteractionType>>, Option<Eq<player, String>>, Option<Eq<target, String>>, Option<Eq<date, NaiveDateTime>>) as Insertable<table>>::Values
fn values( self, ) -> <(Option<Eq<id, String>>, Option<Eq<interaction_type, InteractionType>>, Option<Eq<player, String>>, Option<Eq<target, String>>, Option<Eq<date, NaiveDateTime>>) as Insertable<table>>::Values
Self::Values Read more§fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>where
T: Table,
Self: Sized,
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>where
T: Table,
Self: Sized,
self into a given table. Read moreSource§impl<'insert> Insertable<table> for &'insert Interactionwhere
&'insert String: AsExpression<<id as Expression>::SqlType> + AsExpression<<player as Expression>::SqlType> + AsExpression<<target as Expression>::SqlType>,
&'insert InteractionType: AsExpression<<interaction_type as Expression>::SqlType>,
&'insert NaiveDateTime: AsExpression<<date as Expression>::SqlType>,
impl<'insert> Insertable<table> for &'insert Interactionwhere
&'insert String: AsExpression<<id as Expression>::SqlType> + AsExpression<<player as Expression>::SqlType> + AsExpression<<target as Expression>::SqlType>,
&'insert InteractionType: AsExpression<<interaction_type as Expression>::SqlType>,
&'insert NaiveDateTime: AsExpression<<date as Expression>::SqlType>,
Source§type Values = <(Option<Grouped<Eq<id, <&'insert String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<interaction_type, <&'insert InteractionType as AsExpression<<interaction_type as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player, <&'insert String as AsExpression<<player as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<target, <&'insert String as AsExpression<<target as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<date, <&'insert NaiveDateTime as AsExpression<<date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
type Values = <(Option<Grouped<Eq<id, <&'insert String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<interaction_type, <&'insert InteractionType as AsExpression<<interaction_type as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player, <&'insert String as AsExpression<<player as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<target, <&'insert String as AsExpression<<target as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<date, <&'insert NaiveDateTime as AsExpression<<date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
VALUES clause to insert these records Read moreSource§fn values(
self,
) -> <(Option<Eq<id, &'insert String>>, Option<Eq<interaction_type, &'insert InteractionType>>, Option<Eq<player, &'insert String>>, Option<Eq<target, &'insert String>>, Option<Eq<date, &'insert NaiveDateTime>>) as Insertable<table>>::Values
fn values( self, ) -> <(Option<Eq<id, &'insert String>>, Option<Eq<interaction_type, &'insert InteractionType>>, Option<Eq<player, &'insert String>>, Option<Eq<target, &'insert String>>, Option<Eq<date, &'insert NaiveDateTime>>) as Insertable<table>>::Values
Self::Values Read more§fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>where
T: Table,
Self: Sized,
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>where
T: Table,
Self: Sized,
self into a given table. Read moreSource§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4), __DB> for Interactionwhere
(String, InteractionType, String, Option<String>, Option<NaiveDateTime>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4), __DB> for Interactionwhere
(String, InteractionType, String, Option<String>, Option<NaiveDateTime>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4), __DB>,
Source§impl<__DB: Backend> Selectable<__DB> for Interaction
impl<__DB: Backend> Selectable<__DB> for Interaction
Source§type SelectExpression = (id, interaction_type, player, target, date)
type SelectExpression = (id, interaction_type, player, target, date)
Source§fn construct_selection() -> Self::SelectExpression
fn construct_selection() -> Self::SelectExpression
Source§impl Serialize for Interaction
impl Serialize for Interaction
impl UndecoratedInsertRecord<table> for Interaction
Auto Trait Implementations§
impl Freeze for Interaction
impl RefUnwindSafe for Interaction
impl Send for Interaction
impl Sync for Interaction
impl Unpin for Interaction
impl UnsafeUnpin for Interaction
impl UnwindSafe for Interaction
Blanket Implementations§
§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read more§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read more§fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
§impl<T> CloneAny for T
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DebugAny for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
§fn as_select() -> SelectBy<T, DB>
fn as_select() -> SelectBy<T, DB>
Selectable] implementation. Read more§fn as_returning() -> SelectBy<Self, DB>
fn as_returning() -> SelectBy<Self, DB>
as_select that can be used with returning clauses