View Source LiveQuery.Query.DefLike protocol (LiveQuery v0.3.1)

A query definition defines how to load and maintain a query. It's the blueprint of a query. Anything that implements the LiveQuery.Query.DefLike protocol can be used as a query definition.

Summary

Functions

Your query process is like a GenServer. You can handle calls, but you're limited in what you can return since queries don't allow for handle_continue.

Your query process is like a GenServer. You can handle casts, but you're limited in what you can return since queries don't allow for handle_continue. You must return your query's new value.

Your query process is like a GenServer. You can handle messages, but you're limited in what you can return since queries don't allow for handle_continue. You must return your query's new value.

Called when the query is initialized. This is where the query should be loaded and any subscriptions should be setup.

Types

Functions

Link to this function

handle_call(self, msg, from, state)

View Source
@spec handle_call(
  self :: t(),
  msg :: any(),
  from :: GenServer.from(),
  state :: %{:key => any(), :config => map(), optional(:data) => data()}
) :: {:noreply, data()} | {:reply, any(), data()}

Your query process is like a GenServer. You can handle calls, but you're limited in what you can return since queries don't allow for handle_continue.

Link to this function

handle_cast(self, msg, state)

View Source
@spec handle_cast(
  self :: t(),
  msg :: any(),
  state :: %{:key => any(), :config => map(), optional(:data) => data()}
) :: data()

Your query process is like a GenServer. You can handle casts, but you're limited in what you can return since queries don't allow for handle_continue. You must return your query's new value.

Link to this function

handle_info(self, msg, state)

View Source
@spec handle_info(
  self :: t(),
  msg :: any(),
  state :: %{:key => any(), :config => map(), optional(:data) => data()}
) :: data()

Your query process is like a GenServer. You can handle messages, but you're limited in what you can return since queries don't allow for handle_continue. You must return your query's new value.

@spec init(
  self :: t(),
  state :: %{key: any(), config: map()}
) :: data()

Called when the query is initialized. This is where the query should be loaded and any subscriptions should be setup.