ExSieve v0.8.2 ExSieve.Schema View Source
ExSieve.Schema
is meant to be use
d by modules using Ecto.Schema
.
When used, optional configuration parameters specific for the schema
can be provided. For details about cofngiuration parameters see
ExSieve.Config.t/0
.
defmodule MyApp.User do
use ExSieve.Schema
end
defmodule MyApp.USer do
use ExSieve.Schema, max_depth: 0
end
When using ExSieve.Schema
, the list of not filterable schema fields can be
specified with the @ex_sieve_not_filterable_fields
module attribute.
defmodule MyApp.User do
use Ecto.Schema
use ExSieve.Schema
@ex_sieve_not_filterable_fields [:name, :inserted_at, :comments]
schema "users" do
has_many :comments, ExSieve.Comment
has_many :posts, ExSieve.Post
field :name
field :cash, Money.Ecto.Type
timestamps()
end
end
Filters for fields that are in the list are ignored (an error is returned
if :ignore_errors
is false
). By default all fields are filterable.