Enumex.Dynamic.Components.EctoChangeset behaviour (Enumex v1.0.0)

View Source

Provides ecto changeset functionality for enum schemas.

Dependencies

Requires Ecto.Changeset module from :ecto dependency.

Usage

defmodule MyApp.MyEnums do
  use Enumex.Dynamic, components: [Enumex.Dynamic.Components.EctoChangeset]

  # enum definitions goes here
end

Summary

Callbacks

Creates an ecto changeset for an enum schema with the given attributes.

Callbacks

enum_changeset(schema, map)

@callback enum_changeset(Ecto.Schema.schema(), map()) :: Ecto.Changeset.t()

Creates an ecto changeset for an enum schema with the given attributes.

Parameters

  • enum_schema: The enum schema to modify
  • attrs: A map of attributes to change

Example

%Ecto.Changeset{} = enum_changeset(enum_schema, attrs)