Fulib v0.1.10 Fulib.Params View Source
Link to this section Summary
Functions
Transforms an Ecto.Changeset into a struct
Transforms an Ecto.Changeset into a Map with atom keys
Link to this section Functions
Link to this function
changeset(changeset, params) View Source
Link to this function
data(changeset)
View Source
data(changeset)
View Source
data(Ecto.Changeset.t()) :: struct()
data(Ecto.Changeset.t()) :: struct()
Transforms an Ecto.Changeset into a struct.
Recursively traverses and transforms embedded changesets.
For example if the LoginFulib.Params
module was defined like:
defmodule LoginFulib.Params do
use Fulib.Params.Schema, %{login!: :string, password!: :string}
end
You can transform the changeset returned by from
into an struct like:
data = LoginFulib.Params.from(%{"login" => "foo"}) |> Fulib.Params.data
data.login # => "foo"
Link to this function
default_embeds_from_schema(module) View Source
Link to this function
optional(module) View Source
Link to this function
required(module) View Source
Link to this function
schema(module) View Source
Link to this function
to_map(changeset)
View Source
to_map(changeset)
View Source
to_map(Ecto.Changeset.t()) :: map()
to_map(Ecto.Changeset.t()) :: map()
Transforms an Ecto.Changeset into a Map with atom keys.
Recursively traverses and transforms embedded changesets and skips keys that was not part of params given to changeset