Liking cljdoc? Tell your friends :D

com.timezynk.useful.mongo


acceptance-ofclj

(acceptance-of attribute
               &
               {:keys [allow-nil accept message blank-message message-fn]
                :or {allow-nil false
                     accept #{true "true" "1"}
                     message "must be accepted"
                     blank-message "can't be blank"}})

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:

:message (default:"must be accepted"): returned error message :blank-message (default:"can't be blank"): returned error message if value is not present :message-fn function to retrieve message with signature (fn [type map attribute & args]). type will be :blank or :acceptance, args will be the set of accepted values

: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:

(require '[validateur.validation :refer :all])

(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:

:message (default:"must be accepted"): returned error message
:blank-message (default:"can't be blank"): returned error message if value is not present
:message-fn function to retrieve message with signature (fn [type map attribute & args]).
            type will be :blank or :acceptance, args will be the set of accepted values

: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:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :name)
  (presence-of :age)
  (acceptance-of :terms))
raw docstring

child-ofcljmacro

(child-of attribute & body)

children-ofcljmacro

(children-of attribute & body)

ConvertibleToLongcljprotocol

to-longclj

(to-long o)

Convert to long

Convert to long

copy-attrclj

(copy-attr e k)
(copy-attr e k f)

defvalidatorcljmacro

(defvalidator fn-name & body)

DoubleConvertiblecljprotocol

to-doubleclj

(to-double d)

Convert to double

Convert to double

exclusion-ofclj

(exclusion-of attribute
              &
              {:keys [allow-nil in message blank-message message-fn]
               :or {allow-nil false
                    message "must not be one of: "
                    blank-message "can't be blank"}})

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:

:blank-message (default:"can't be blank"): returned error message if value is not present :message-fn (default nil): function to retrieve message with signature (fn [type map attribute & args]). type will be :blank or :exclusion, args will be the set of invalid values :message (default: "must not be one of: "): returned error message (with comma separated list of invalid values appended) :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:

(require '[validateur.validation :refer :all])

(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:

:blank-message (default:"can't be blank"): returned error message if value is not present
:message-fn (default nil): function to retrieve message with signature (fn [type map attribute & args]).
                           type will be :blank or :exclusion, args will be the set of invalid values
:message (default: "must not be one of: "): returned error message
                                              (with comma separated list of invalid values appended)
: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:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :name)
  (presence-of :age)
  (exclusion-of :status :in #{"banned" "non-activated"}))
raw docstring

extend-defaultsclj

(extend-defaults defaults entry)

fetchclj

(fetch & args)

find-by-idclj

(find-by-id collection id)

format-ofclj

(format-of attribute
           &
           {:keys [allow-nil allow-blank format message blank-message
                   message-fn]
            :or {allow-nil false
                 allow-blank false
                 message "has incorrect format"
                 blank-message "can't be blank"}})

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 :message (default: "has incorrect format"): an error message for invalid values :blank-message (default:"can't be blank"): returned error message if value is not present :message-fn (default nil): function to retrieve message with signature (fn [type map attribute & args]). type will be :format or :blank, args will be the applied format

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(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
:message (default: "has incorrect format"): an error message for invalid values
:blank-message (default:"can't be blank"): returned error message if value is not present
:message-fn (default nil): function to retrieve message with signature (fn [type map attribute & args]).
                           type will be :format or :blank, args will be the applied format

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :username)
  (presence-of :age)
  (format-of :username :format #"[a-zA-Z0-9_]")
raw docstring

get-id-inclj

(get-id-in m ks)

get-ids-inclj

(get-ids-in m ks)

inclusion-ofclj

(inclusion-of attribute
              &
              {:keys [allow-nil in message blank-message message-fn]
               :or {allow-nil false
                    message "must be one of: "
                    blank-message "can't be blank"}})

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:

:blank-message (default:"can't be blank"): returned error message if value is not present :message (default: "must be one of: "): returned error message (with comma-separated valid values appended) :message-fn (default:nil): function to retrieve message with signature (fn [type map attribute & args]). type will be :blank or :inclusion, args will be the set of valid values

: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:

(require '[validateur.validation :refer :all])

(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:

:blank-message (default:"can't be blank"): returned error message if value is not present
:message (default: "must be one of: "): returned error message
                                          (with comma-separated valid values appended)
:message-fn (default:nil): function to retrieve message with signature (fn [type map attribute & args]).
                           type will be :blank or :inclusion, args will be the set of valid values

: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:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :name)
  (presence-of :age)
  (inclusion-of :team :in #{"red" "blue"}))
raw docstring

insert!clj

(insert! collection entry)

insert-and-wait!clj

(insert-and-wait! collection entry)

intersecting-queryclj

(intersecting-query from to)
(intersecting-query from to start-key end-key)

length-ofclj

(length-of
  attribute
  &
  {:keys [allow-nil is within allow-blank blank-message message-fn]
   :or {allow-nil false allow-blank false blank-message "can't be blank"}})

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 :blank-message (default:"can't be blank"): returned error message if value is not present :message-fn (default nil): function to retrieve message with signature (fn [type m attribute & args]). type will be :length:is or :length:within, args will be the applied number or range

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(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
:blank-message (default:"can't be blank"): returned error message if value is not present
:message-fn (default nil): function to retrieve message with signature (fn [type m attribute & args]).
                           type will be :length:is or :length:within, args will be the applied number or range

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(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)
raw docstring

map-copy-attrcljmacro

(map-copy-attr e ks)
(map-copy-attr e ks f)

nil-empty-stringsclj

(nil-empty-strings a)

numericality-ofclj

(numericality-of attribute
                 &
                 {:keys [allow-nil only-integer gt gte lt lte equal-to odd even
                         messages message-fn]
                  :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:

:messages : a map of type->message to be merge with defaults :message-fn (default:nil): function to retrieve message with signature (fn [type map attribute & args]) type will be one of [:blank :number :integer :odd :even :equal-to :gt :gte :lt :lte] args will be the numeric constraint if any

: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:

(require '[validateur.validation :refer :all])

(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:

:messages : a map of type->message to be merge with defaults
:message-fn (default:nil):
            function to retrieve message with signature (fn [type map attribute & args])
            type will be one of [:blank :number :integer  :odd  :even
                                 :equal-to :gt  :gte :lt :lte]
            args will be the numeric constraint if any

: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:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :name)
  (presence-of :age)
  (numericality-of :age :only-integer true :gte 18))
raw docstring

object-id-ofclj

(object-id-of attribute)

object-id-qclj

(object-id-q k id)

object-id?clj

(object-id? s)

object-idsclj

(object-ids ids)

object-ids-qclj

(object-ids-q k ids)

OBJECT_ID_REGEXclj


pack-idclj

(pack-id entry)

PotentialObjectIdcljprotocol

object-idclj

(object-id o)

Convert to object id

Convert to object id

presence-ofclj

(presence-of attributes
             &
             {:keys [message message-fn any] :or {message "can't be blank"}})

Returns a function that, when given a map, will validate presence of the attribute(s) in that map.

Attributes can be given as a set or as a single attribute. Individual attributes can be vectors and they are treated as arguments to get-in (nested attributes).

Accepted options: :message (default:"can't be blank"): returned error message :message-fn (default:nil): function to retrieve message with signature (fn [type map attribute & args]) type will be :blank, args will be nil :any (default:nil): if true, validation succeeds when any attribute from the set is present the default is to require all attributes from the set to be present

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(validation-set (presence-of :name) (presence-of :age))

Or on its own:

(presence-of #{:name :age})

Returns a function that, when given a map, will validate presence of the attribute(s) in that map.

Attributes can be given as a set or as a single attribute.
Individual attributes can be vectors and they are treated as arguments to get-in (nested attributes).

Accepted options:
:message (default:"can't be blank"): returned error message
:message-fn (default:nil): function to retrieve message with signature (fn [type map attribute & args])
                           type will be :blank, args will be nil
:any (default:nil): if true, validation succeeds when any attribute from the set is present
                    the default is to require all attributes from the set to be present

Used in conjunction with validation-set:

(require '[validateur.validation :refer :all])

(validation-set
  (presence-of :name)
  (presence-of :age))

Or on its own:

(presence-of #{:name :age})
raw docstring

start-inside-period-queryclj

(start-inside-period-query from to)
(start-inside-period-query from to start-key)

unpack-idclj

(unpack-id entry)

unpack-idsclj

(unpack-ids entries)

validate-allclj

(validate-all vs entries)

validate-object-idclj

(validate-object-id & ids)

validate-stringclj

(validate-string & strings)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close