View Source Nex.Messages (Nex v0.1.0)
Messages context module.
This is the main interface for storing and retrieving events from the database.
Link to this section Summary
Functions
Inserts the given event parameters to the database.
Inserts the given event parameters to the database, and deletes previous events of the same kind from the same author.
Inserts the given event parameters to the database, and deletes events
referenced in e
tags.
Lists events by the given list of filters. Multiple conditions in the same
filter are AND
conditions. Multiple filters are OR
conditions.
As f:list_events/1
but streams the query results. The given callback
function is invoked for each event row.
Link to this section Functions
@spec insert_event(map()) :: {:ok, Nex.Messages.Event.t()} | {:error, Ecto.Changeset.t()}
Inserts the given event parameters to the database.
@spec insert_event_and_drop_previous(map()) :: {:ok, any()} | {:error, any()} | {:error, Ecto.Multi.name(), any(), map()}
Inserts the given event parameters to the database, and deletes previous events of the same kind from the same author.
Use this for storing contact lists and metadata events.
@spec insert_event_and_drop_tagged(map()) :: {:ok, any()} | {:error, any()} | {:error, Ecto.Multi.name(), any(), map()}
Inserts the given event parameters to the database, and deletes events
referenced in e
tags.
Use this for NIP-09 events.
@spec list_events([Nex.Messages.Filter.t()]) :: [Nex.Messages.Event.t()]
Lists events by the given list of filters. Multiple conditions in the same
filter are AND
conditions. Multiple filters are OR
conditions.
See Nex.Messages.Filter
for details fo a valid filter.
@spec stream_events([Nex.Messages.Filter.t()], (Nex.Messages.Event.t() -> any())) :: list()
As f:list_events/1
but streams the query results. The given callback
function is invoked for each event row.