Skip to main content

Interaction

Struct Interaction 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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.

Source

pub async fn get_zombie_tree() -> Result<(Vec<ZombieTree>, HashMap<String, (PlayerState, PlayerRole)>), String>

Get the zombie tree

Z0 is returned as anonymous

§Returns

A vector of ZombieTree objects representing the zombie tree.

§Errors

Returns an error string if there was an error retrieving the zombie tree.

Source

pub async fn delete(id: String) -> Result<(), String>

This function is used to delete an interaction:

§Arguments
  • id - The ID of the interaction to delete.
§Returns

A result indicating success or failure.

Trait Implementations§

Source§

impl Clone for Interaction

Source§

fn clone(&self) -> Interaction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interaction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Interaction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Insertable<table> for Interaction
where 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

The VALUES clause to insert these records Read more
Source§

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

Construct Self::Values Read more
§

fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
where T: Table, Self: Sized,

Insert self into a given table. Read more
Source§

impl<'insert> Insertable<table> for &'insert Interaction
where &'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

The VALUES clause to insert these records Read more
Source§

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

Construct Self::Values Read more
§

fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
where T: Table, Self: Sized,

Insert self into a given table. Read more
Source§

impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4), __DB> for Interaction

Source§

type Row = (String, InteractionType, String, Option<String>, Option<NaiveDateTime>)

The Rust type you’d like to map from. Read more
Source§

fn build( row: (String, InteractionType, String, Option<String>, Option<NaiveDateTime>), ) -> Result<Self>

Construct an instance of this type
Source§

impl<__DB: Backend> Selectable<__DB> for Interaction

Source§

type SelectExpression = (id, interaction_type, player, target, date)

The expression you’d like to select. Read more
Source§

fn construct_selection() -> Self::SelectExpression

Construct an instance of the expression
Source§

impl Serialize for Interaction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl UndecoratedInsertRecord<table> for Interaction

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AggregateExpressionMethods for T

§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneAny for T
where T: Any + Clone + Send + Sync,

§

fn clone_any(&self) -> Box<dyn CloneAny>

§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>

§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>

§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Send + Sync>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, DB> SelectableHelper<DB> for T
where T: Selectable<DB>, DB: Backend,

§

fn as_select() -> SelectBy<T, DB>

Construct a select clause based on a [Selectable] implementation. Read more
§

fn as_returning() -> SelectBy<Self, DB>

An alias for as_select that can be used with returning clauses
§

impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
where ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,

§

const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE

The number of fields that this type will consume.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> UnsafeAny for T
where T: Any,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WindowExpressionMethods for T

§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more