View Source Indexed.Managed.Helpers (Indexed v0.0.1)

Some tools for Indexed.Managed.

Link to this section Summary

Functions

Given a preload function spec, create a preload function. key is the key of the parent entity which should be filled with the child or list of children.

Invoke fun with the managed state, finding it in the :managed key if needed. If fun returns a managed state and it was wrapped, rewrap it.

Link to this section Functions

Link to this function

assoc_from_record(record, path_entry)

View Source
@spec assoc_from_record(record(), atom()) :: record() | nil
@spec build_query(Indexed.Managed.t()) :: Ecto.Queryable.t()
Link to this function

drop_associations(schema, assocs \\ nil)

View Source
@spec drop_associations(
  struct(),
  [atom()] | nil
) :: struct()
Link to this function

get_fkey(module, path_entry)

View Source
@spec get_fkey(module(), atom()) :: atom()
@spec get_managed(state() | module(), atom()) :: Indexed.Managed.t()
Link to this function

has_referring_many?(state, match_name, match_id)

View Source
@spec has_referring_many?(state(), atom(), id()) :: boolean()
@spec preload_fn(assoc_spec(), module()) :: (map(), state() -> any()) | nil

Given a preload function spec, create a preload function. key is the key of the parent entity which should be filled with the child or list of children.

See t:preload/0.

Link to this function

subscribe(mod, name, id)

View Source
@spec subscribe(module(), atom(), id()) :: any()
Link to this function

unsubscribe(mod, name, id)

View Source
@spec unsubscribe(module(), atom(), id()) :: any()
Link to this function

with_state(wrapper, fun)

View Source
@spec with_state(Indexed.Managed.state_or_wrapped(), (state() -> any())) :: any()

Invoke fun with the managed state, finding it in the :managed key if needed. If fun returns a managed state and it was wrapped, rewrap it.