Karta. Messages. Search
(Karta v1.0.0)
What the messages of a server are searched for, cast from the query
string of the messages page (cast/1), and the query it makes (query/2):
q- text found, without regard to case, in the envelope sender, an envelope recipient, the From address, the subject or the Message-ID (at most 200 characters);status- messages with at least one recipient in this state (queued,deferred,delivered,bounced,suppressed,cancelled);delivery- received messages with at least one inbound delivery in this state (pending,delivered,failed,accepted,held);tag- messages with this tag, exactly;from,to- dates (YYYY-MM-DD, UTC): messages accepted on or after the first, on or before the second.
cast/2 takes the fields a page offers; the ones it leaves out are not
read from the parameters, so a page cannot be searched by a field it does
not show.
A value that does not cast or validate is reported in the changeset and ignored in the search; the other values still count.
Summary
Functions
Casts query parameters (string keys; others are ignored). Returns the search made of the valid values, and the changeset with the errors of the others (for the form).
As cast/1, for a page that offers only fields (a subset of :q,
:status, :delivery, :tag, :from, :to).
The delivery states of received messages that can be searched for.
query (of messages, named :message) narrowed to what the search asks for.
The recipient states that can be searched for.
The search as query parameters (only the values set), for links.
Types
Functions
@spec cast(map()) :: {t(), Ecto.Changeset.t()}
Casts query parameters (string keys; others are ignored). Returns the search made of the valid values, and the changeset with the errors of the others (for the form).
@spec cast(map(), [atom()]) :: {t(), Ecto.Changeset.t()}
As cast/1, for a page that offers only fields (a subset of :q,
:status, :delivery, :tag, :from, :to).
@spec delivery_statuses() :: [atom()]
The delivery states of received messages that can be searched for.
@spec query(t(), Ecto.Query.t()) :: Ecto.Query.t()
query (of messages, named :message) narrowed to what the search asks for.
@spec statuses() :: [atom()]
The recipient states that can be searched for.
The search as query parameters (only the values set), for links.