(acceptance-of attribute
&
{:keys [allow-nil accept]
:or {allow-nil false accept #{true "true" "1"}}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is accepted. By default, values that are considered accepted: true, "true", "1". Primarily used for validation of data that comes from Web forms.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :accept (default: #{true, "true", "1"}): pass to use a custom list of values that will be considered accepted
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age) (acceptance-of :terms))
Returns a function that, when given a map, will validate that the value of the attribute in that map is accepted. By default, values that are considered accepted: true, "true", "1". Primarily used for validation of data that comes from Web forms. Accepted options: :allow-nil (default: false): should nil values be allowed? :accept (default: #{true, "true", "1"}): pass to use a custom list of values that will be considered accepted Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age) (acceptance-of :terms))
(child-of attribute & body)
(children-of attribute & body)
(to-long o)
Convert to long
Convert to long
(copy-attr e k)
(copy-attr e k f)
(defvalidator fn-name & body)
(to-double d)
Convert to double
Convert to double
(exclusion-of attribute & {:keys [allow-nil in] :or {allow-nil false}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is not one of the given.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :in (default: nil): a collection of invalid values for the attribute
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age) (exclusion-of :status :in #{"banned" "non-activated"}))
Returns a function that, when given a map, will validate that the value of the attribute in that map is not one of the given. Accepted options: :allow-nil (default: false): should nil values be allowed? :in (default: nil): a collection of invalid values for the attribute Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age) (exclusion-of :status :in #{"banned" "non-activated"}))
(extend-defaults defaults entry)
(format-of attribute
&
{:keys [allow-nil allow-blank format]
:or {allow-nil false allow-blank false}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is in the given format.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :allow-blank (default: false): should blank string values be allowed? :format (default: nil): a regular expression of the format
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :username) (presence-of :age) (format-of :username :format #"[a-zA-Z0-9_]")
Returns a function that, when given a map, will validate that the value of the attribute in that map is in the given format. Accepted options: :allow-nil (default: false): should nil values be allowed? :allow-blank (default: false): should blank string values be allowed? :format (default: nil): a regular expression of the format Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :username) (presence-of :age) (format-of :username :format #"[a-zA-Z0-9_]")
(get-id-in m ks)
(get-ids-in m ks)
(inclusion-of attribute & {:keys [allow-nil in] :or {allow-nil false}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is one of the given.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :in (default: nil): a collection of valid values for the attribute
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age) (inclusion-of :team :in #{"red" "blue"}))
Returns a function that, when given a map, will validate that the value of the attribute in that map is one of the given. Accepted options: :allow-nil (default: false): should nil values be allowed? :in (default: nil): a collection of valid values for the attribute Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age) (inclusion-of :team :in #{"red" "blue"}))
(length-of attribute
&
{:keys [allow-nil is within allow-blank]
:or {allow-nil false allow-blank false}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is of the given length.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :allow-blank (default: false): should blank string values be allowed? :is (default: nil): an exact length, as long :within (default: nil): a range of lengths
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age) (length-of :password :within (range 6 100))
(validation-set (presence-of :name) (presence-of :age) (length-of :zip :is 5)
Returns a function that, when given a map, will validate that the value of the attribute in that map is of the given length. Accepted options: :allow-nil (default: false): should nil values be allowed? :allow-blank (default: false): should blank string values be allowed? :is (default: nil): an exact length, as long :within (default: nil): a range of lengths Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age) (length-of :password :within (range 6 100)) (validation-set (presence-of :name) (presence-of :age) (length-of :zip :is 5)
(map-copy-attr e ks)
(map-copy-attr e ks f)
(nil-empty-strings a)
(numericality-of attribute
&
{:keys [allow-nil only-integer gt gte lt lte equal-to odd even]
:or
{allow-nil false only-integer false odd false even false}})
Returns a function that, when given a map, will validate that the value of the attribute in that map is numerical.
Accepted options:
:allow-nil (default: false): should nil values be allowed? :only-integer (default: false): should only integer values be allowed? :even (default: false): should even values be allowed? :odd (default: false): should odd values be allowed? :equal-to: accept only values equal to the given :gt: accept only values greater than the given :gte: accept only values greater than or equal to the given :lt: accept only values less than the given :lte: accept only values less than or equal to the given
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age) (numericality-of :age :only-integer true :gte 18))
Returns a function that, when given a map, will validate that the value of the attribute in that map is numerical. Accepted options: :allow-nil (default: false): should nil values be allowed? :only-integer (default: false): should only integer values be allowed? :even (default: false): should even values be allowed? :odd (default: false): should odd values be allowed? :equal-to: accept only values equal to the given :gt: accept only values greater than the given :gte: accept only values greater than or equal to the given :lt: accept only values less than the given :lte: accept only values less than or equal to the given Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age) (numericality-of :age :only-integer true :gte 18))
(object-id-of attribute)
(object-id-or-self id)
(object-id-q k id)
(object-id? s)
(object-ids ids)
(object-ids-q k ids)
(pack-id entry)
(object-id o)
Convert to object id
Convert to object id
(presence-of attribute)
Returns a function that, when given a map, will validate presence of the attribute in that map.
Used in conjunction with validation-set:
(use 'validateur.validations)
(validation-set (presence-of :name) (presence-of :age))
Returns a function that, when given a map, will validate presence of the attribute in that map. Used in conjunction with validation-set: (use 'validateur.validations) (validation-set (presence-of :name) (presence-of :age))
(unpack-id entry)
(unpack-ids entries)
(validate-all vs entries)
(validate-object-id & ids)
(validate-string & strings)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close