concept field in category elixir

appears as: field, field, fields, fields
Phoenix in Action

This is an excerpt from Manning's book Phoenix in Action.

Listing 7.5. Defining Auction.Item’s schema for Ecto
defmodule Auction.Item do
  use Ecto.Schema

  schema "items" do
    field :title, :string
    field :description, :string
    field :ends_at, :utc_datetime
    timestamps()                     #1
  end
end
Listing 8.3. Using Ecto.Changeset.cast/4 to limit the fields you accept changes for
defmodule Auction.Item do
  # ...

  def changeset(item, params \\ %{}) do
    item
    |> Ecto.Changeset.cast(params, [:title, :description, :ends_at])    #1
  end
end
Table 8.1. Built-in validation functions in Ecto.Changeset (view table figure)

Function

Description

validate_confirmation/3 Validates that two fields are identical (like password and password_confirmation)
validate_exclusion/4 Validates that a field’s value isn’t in the provided list
validate_format/4 Validates that a value matches a regular expression
validate_inclusion/4 Validates that a field’s value is in the provided list; opposite of validate_exclusion/4
validate_length/3 Validates that a value is of a certain length
validate_number/3 Various validation options around numbers (less than, greater than, etc.)
validate_required/3 Validates that a field is present
validate_subset/4 Validates that a value, which is a list, is a subset of another list