Zodish.Type.String (zodish v0.2.4)

View Source

This module describes a Zodish string type.

Summary

Functions

Either enables or disables coercion for the given String type.

Either enables or disables downcasing for the given String type. If enabled, the string will be downcased before performing any other validations.

Creates a new String type.

Either enables or disables trimming for the given String type. If enabled, the string will be trimmed before performing any other validations.

Either enables or disables upcasing for the given String type. If enabled, the string will be upcased before performing any other validations.

Types

t()

@type t() :: %Zodish.Type.String{
  coerce: boolean(),
  downcase: boolean(),
  ends_with: Zodish.Option.t(String.t()) | nil,
  length: Zodish.Option.t(non_neg_integer()) | nil,
  max: Zodish.Option.t(non_neg_integer()) | nil,
  min: Zodish.Option.t(non_neg_integer()) | nil,
  regex: Zodish.Option.t(Regex.t()) | nil,
  starts_with: Zodish.Option.t(String.t()) | nil,
  trim: boolean(),
  upcase: boolean()
}

Functions

coerce(type, value \\ true)

Either enables or disables coercion for the given String type.

downcase(type, value \\ true)

Either enables or disables downcasing for the given String type. If enabled, the string will be downcased before performing any other validations.

ends_with(type, value, opts \\ [])

length(type, value, opts \\ [])

max(type, value, opts \\ [])

min(type, value, opts \\ [])

new(opts \\ [])

Creates a new String type.

regex(type, value, opts \\ [])

starts_with(type, value, opts \\ [])

trim(type, value \\ true)

Either enables or disables trimming for the given String type. If enabled, the string will be trimmed before performing any other validations.

upcase(type, value \\ true)

Either enables or disables upcasing for the given String type. If enabled, the string will be upcased before performing any other validations.