Ecto Schema Store v2.3.1 EctoSchemaStore.Proxy View Source

Generates proxy functions that pass off to the desired store module.

When used with a schema module, this is usually not possible with import because we the store cannot be compiled until the schema is compiled. But the schema cannot import until the store is compiled, so generally, the functions cannot be brought into the store directly. Thbis solution works around that and allows the functions to be public so that you can call the store functions on the schema module.

You cannot use multiple store modules at once as that each would override the others. There is no requirement to place this on the schema module, it can be included in any Elixir module.

Functions Included:

  • one
  • all
  • insert
  • insert!
  • insert_fields
  • insert_fields!
  • update
  • update!
  • update_fields
  • update_fields!
  • update_or_create
  • update_or_create!
  • update_or_create_fields
  • update_or_create_fields!
  • delete
  • delete!
  • delete_all
  • generate
  • generate!
  • generate_default
  • generate_default!
  • exists?
  • to_map
  • count_records
  • preload_assocs
  • find_or_create
  • find_or_create!
  • find_or_create_fields
  • find_or_create_fields!
  • validate_insert
  • validate_update
  • transaction
  • refresh
defmodule Person do
  use Ecto.Schema
  use EctoSchemaStore.proxy, module: PersonStore
end

Link to this section Summary

Link to this section Functions

Link to this function generate(function, arguments) View Source