Rill v0.10.4 Rill.EntityStore behaviour View Source

Link to this section Summary

Functions

Same as get, but the entity is never nil. If it's nil, the provided entity is used

Callbacks

Returns the entity if no include is provided, otherwise a list with entity as first element and the other requested fields in the same order as written in include option. If the entity does not exists (nothing was written to the stream), nil is returned

Link to this section Types

Link to this type

get_option() View Source
get_option() :: [{:include, [include_option()] | include_option()}]

Link to this type

include_option() View Source
include_option() :: :id | :version

Link to this section Functions

Link to this function

fetch(session, category, projection, entity, id, opts \\ []) View Source
fetch(
  session :: Rill.Session.t(),
  category :: String.t(),
  projection :: module(),
  entity() :: any(),
  id :: String.t(),
  opts :: get_option()
) :: any() | list()

Same as get, but the entity is never nil. If it's nil, the provided entity is used

Link to this function

get(session, category, projection, entity, id, opts \\ []) View Source
get(
  session :: Rill.Session.t(),
  category :: String.t(),
  projection :: module(),
  entity() :: any(),
  id :: String.t(),
  opts :: get_option()
) :: any() | list()

Link to this section Callbacks

Link to this callback

fetch(session, id, opts) View Source
fetch(session :: Rill.Session.t(), id :: String.t(), opts :: get_option()) ::
  any() | list()

Link to this callback

get(session, id, opts) View Source
get(session :: Rill.Session.t(), id :: String.t(), opts :: get_option()) ::
  nil | any() | list()

Returns the entity if no include is provided, otherwise a list with entity as first element and the other requested fields in the same order as written in include option. If the entity does not exists (nothing was written to the stream), nil is returned