Lethe.Query (Lethe v0.5.0) View Source

A Lethe query. Queries are what Lethe transforms into Mnesia-compatible matchspecs for processing. A query is constructed from nothing but a table name, provided to Lethe.new/1. Queries have sane defaults:

  • Return all fields
  • Read lock
  • Return all matches

Queries can be updated with several functions:

When you're finished creating a query, you must then compile it with Lethe.compile/1, which converts the query into a form that can be passed to Mnesia. Copmiled queries can be executed with Lethe.run/1; while it is possible to take the output from Lethe.compile/1 and run it manually, doing so is not advised.

Link to this section Summary

Link to this section Types

Specs

t() :: %Lethe.Query{
  fields: %{required(Lethe.field()) => non_neg_integer()} | nil,
  limit: Lethe.limit() | nil,
  lock: Lethe.lock() | nil,
  ops: [Lethe.matchspec_condition()] | nil,
  select: [Lethe.field()] | nil,
  table: Lethe.table() | nil
}