Proca.Schema (proca v3.4.1)

Contains helpers for writing Proca Schemas. use Proca.Schema, module: Proca.MyRecordModule

defines:

  • MyRecordModule.all(criteria_keyword_list) and you implement methods that customize the query according to criteria, eg:
MyRecordModule.all(query, [{:foo, foo} | kw]), do: query |> where([x], x.foo == ^foo) |> all(kw)

After the criteria run out, list of records is returned. If last criteria is [one: true] then Repo.one() is called.

  • MyRecordModule.one(criteria_keyword_list) calls all(criteria_keyword_list ++ [one: true])