View Source Indexed.Entity (Indexed v0.0.1)

Configuration for a type of thing to be indexed.

Link to this section Summary

Types

A field to be indexed. 2-element tuple has the field name and options.

Configuration info for a prefilter.

t()
  • :fields - List of field/0s to be indexed for this entity.
  • :id_key - Specifies how to find the id for a record. It can be an atom field name to access, a function, or a tuple in the form {module, function_name}. In the latter two cases, the record will be passed in. Default :id.
  • :prefilters - List of tuples indicating which fields should be prefiltered on. This means that separate indexes will be managed for each unique value for each of these fields, across all records of this entity type. Each two-element tuple has the field name atom and a keyword list of options. Allowed options:
  • :ref - ETS table reference where records of this entity type are stored, keyed by id.

Link to this section Types

@type field() :: {name :: atom(), opts :: keyword()}

A field to be indexed. 2-element tuple has the field name and options.

options

Options

  • :sort - Indicates how the field should be sorted in ascending order:
@type prefilter_config() :: {atom(), opts :: keyword()}

Configuration info for a prefilter.

@type t() :: %Indexed.Entity{
  fields: [field()],
  id_key: any(),
  prefilters: [prefilter_config()],
  ref: :ets.tid()
}
  • :fields - List of field/0s to be indexed for this entity.
  • :id_key - Specifies how to find the id for a record. It can be an atom field name to access, a function, or a tuple in the form {module, function_name}. In the latter two cases, the record will be passed in. Default :id.
  • :prefilters - List of tuples indicating which fields should be prefiltered on. This means that separate indexes will be managed for each unique value for each of these fields, across all records of this entity type. Each two-element tuple has the field name atom and a keyword list of options. Allowed options:
  • :ref - ETS table reference where records of this entity type are stored, keyed by id.