Haytni.TrackablePlugin.QueryHelpers (Haytni v0.7.0) View Source

This module provides some basic helpers to query connections to be independant and not have to know the internals of the Trackable plugin.

Link to this section Summary

Functions

Composes query to filter on connection between an interval

Composes query to filter on connection date

Composes query to filter on ip address

Returns a queryable for all invitations

Returns a queryable for all connections of user

Link to this section Functions

Link to this function

and_where_date_between(query, first, last)

View Source

Specs

and_where_date_between(
  query :: Ecto.Queryable.t(),
  first :: nil | Date.t() | DateTime.t() | NaiveDateTime.t(),
  last :: nil | Date.t() | DateTime.t() | NaiveDateTime.t()
) :: Ecto.Query.t()

Composes query to filter on connection between an interval

Link to this function

and_where_date_equals(query, date)

View Source

Specs

and_where_date_equals(
  query :: Ecto.Queryable.t(),
  date :: Date.t() | DateTime.t() | NaiveDateTime.t()
) :: Ecto.Query.t()

Composes query to filter on connection date

Link to this function

and_where_ip_equals(query, ip)

View Source

Specs

and_where_ip_equals(query :: Ecto.Queryable.t(), ip :: String.t()) ::
  Ecto.Query.t()

Composes query to filter on ip address

Link to this function

connections_from_all(user)

View Source

Specs

connections_from_all(user :: Haytni.user()) :: Ecto.Query.t()

Returns a queryable for all invitations

Note: user is not used for the query, just to find the scope/table/association

Link to this function

connections_from_user(user)

View Source

Specs

connections_from_user(user :: Haytni.user()) :: Ecto.Query.t()

Returns a queryable for all connections of user