NLdoc.Spec.OrderedList (NLdoc.Spec v3.1.1)
View SourceThis module defines the Ecto schema for the NLdoc spec OrderedList object.
Summary
Functions
This function creates a new NLdoc.Spec.OrderedList
struct from a map of keys and values, where the keys are snake_case.
Returns a tuple with either {:ok, ordered_list}
or {:error, changeset}
.
This function creates a new NLdoc.Spec.OrderedList
struct from a map of keys and values, where the keys are snake_case.
Returns the ordered_list}
object or raises an Ecto.CastError
.
This validation function can be used in changeset/2
implementations to ensure that
the value for a specific field is a valid URL.
Types
@type style_type() ::
:decimal | :"lower-alpha" | :"upper-alpha" | :"lower-roman" | :"upper-roman"
@type t() :: %NLdoc.Spec.OrderedList{ children: [NLdoc.Spec.ListItem.t()], descriptors: [NLdoc.Spec.descriptor()], id: Ecto.UUID.t(), reversed: boolean(), start: integer(), style_type: :decimal | :"lower-alpha" | :"upper-alpha" | :"lower-roman" | :"upper-roman", type: String.t() }
Functions
@spec changeset( struct(), map() ) :: Ecto.Changeset.t()
@spec new(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
This function creates a new NLdoc.Spec.OrderedList
struct from a map of keys and values, where the keys are snake_case.
Returns a tuple with either {:ok, ordered_list}
or {:error, changeset}
.
Note: If you want to use a map with camelCase keys, use NLdoc.Util.Recase.to_snake/1
to convert them to snake_case before passing them to the constructor.
This function creates a new NLdoc.Spec.OrderedList
struct from a map of keys and values, where the keys are snake_case.
Returns the ordered_list}
object or raises an Ecto.CastError
.
Note: If you want to use a map with camelCase keys, use NLdoc.Util.Recase.to_snake/1
to convert them to snake_case before passing them to the constructor.
@spec validate_url(Ecto.Changeset.t(), atom(), [validate_url_opt()]) :: Ecto.Changeset.t()
This validation function can be used in changeset/2
implementations to ensure that
the value for a specific field is a valid URL.
Options
:message
- The error message to use when the URL is invalid.:allow_relative
- If set totrue
, relative URLs are allowed. Default isfalse
.