EctoSharding v0.0.6 EctoSharding.Schema View Source
An Ecto.Schema
wrapper. This should be used in place of use Ecto.Schema
.
In addition to supporting any configuration allowed by Ecto.Schema
, the
__using__
macro here supports the :sharded
option to note a schema as
sharded or not sharded. All schemas default to sharded unless you explicitly
set sharded: false
.
Example
A sharded schema
defmodule MyApp.User do
use EctoSharding.Schema
schema "users" do
field :name, :string
field :email, :string
end
end
A not-sharded schema
defmodule MyApp.Account do
use EctoSharding.Schema, sharded: false
schema "accounts" do
field :name, :string
field :owner_email, :string
end
end