View Source Indexed.Helpers (Indexed v0.0.1)
Helper functions for internal use.
Link to this section Summary
Functions
Get the id of the record being operated on from an action state.
Get the id of the record being operated on.
Convert a field-only order hint into a tuple one.
Convert a preload shorthand into a predictable data structure.
Link to this section Functions
Get the id of the record being operated on from an action state.
See id_value/2
.
Get the id of the record being operated on.
See Indexed.Entity.t/0
.
@spec normalize_order_hint(Indexed.order_hint()) :: [{:asc | :desc, atom()}]
Convert a field-only order hint into a tuple one.
Convert a preload shorthand into a predictable data structure.
examples
Examples
iex> normalize_preload(:foo)
[foo: []]
iex> normalize_preload([:foo, bar: :baz])
[foo: [], bar: [baz: []]]