Fulib v0.1.6 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

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

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