Liking cljdoc? Tell your friends :D

schema.coerce

Extension of schema for input coercion (coercing an input to match a schema)

Extension of schema for input coercion (coercing an input to match a schema)
raw docstring

coercerclj/s

(coercer schema coercion-matcher)

Inputs: [schema coercion-matcher :- CoercionMatcher]

Produce a function that simultaneously coerces and validates a datum. Returns a coerced value, or a schema.utils.ErrorContainer describing the error.

Inputs: [schema coercion-matcher :- CoercionMatcher]

Produce a function that simultaneously coerces and validates a datum.  Returns
 a coerced value, or a schema.utils.ErrorContainer describing the error.
sourceraw docstring

coercer!clj/s

(coercer! schema coercion-matcher)

Inputs: [schema coercion-matcher :- CoercionMatcher]

Like coercer, but is guaranteed to return a value that satisfies schema (or throw).

Inputs: [schema coercion-matcher :- CoercionMatcher]

Like `coercer`, but is guaranteed to return a value that satisfies schema (or throw).
sourceraw docstring

CoercionMatcherclj/s

A function from schema to coercion function, or nil if no special coercion is needed. The returned function is applied to the corresponding data before validation (or walking/ coercion of its sub-schemas, if applicable)

A function from schema to coercion function, or nil if no special coercion is needed.
The returned function is applied to the corresponding data before validation (or walking/
coercion of its sub-schemas, if applicable)
sourceraw docstring

edn-read-stringclj/s

Reads one object from a string. Returns nil when string is nil or empty

Reads one object from a string. Returns nil when string is nil or empty
sourceraw docstring

first-matcherclj/s

(first-matcher matchers)

Inputs: [matchers :- [CoercionMatcher]] Returns: CoercionMatcher

A matcher that takes the first match from matchers.

Inputs: [matchers :- [CoercionMatcher]]
Returns: CoercionMatcher

A matcher that takes the first match from matchers.
sourceraw docstring

json-coercion-matcherclj/s

(json-coercion-matcher schema)

A matcher that coerces keywords and keyword eq/enums from strings, and longs and doubles from numbers on the JVM (without losing precision)

A matcher that coerces keywords and keyword eq/enums from strings, and longs and doubles
from numbers on the JVM (without losing precision)
sourceraw docstring

keyword-enum-matcherclj/s

(keyword-enum-matcher schema)
source

safeclj/s

(safe f)

Take a single-arg function f, and return a single-arg function that acts as identity if f throws an exception, and like f otherwise. Useful because coercers are not explicitly guarded for exceptions, and failing to coerce will generally produce a more useful error in this case.

Take a single-arg function f, and return a single-arg function that acts as identity
if f throws an exception, and like f otherwise.  Useful because coercers are not explicitly
guarded for exceptions, and failing to coerce will generally produce a more useful error
in this case.
sourceraw docstring

safe-long-castclj

Coerce x to a long if this can be done without losing precision, otherwise return x.

Coerce x to a long if this can be done without losing precision, otherwise return x.
sourceraw docstring

Schemaclj/s

A Schema for Schemas

A Schema for Schemas
sourceraw docstring

set-matcherclj/s

(set-matcher schema)
source

string->booleanclj/s

(string->boolean s)

returns true for strings that are equal, ignoring case, to the string 'true' (following java.lang.Boolean/parseBoolean semantics)

returns true for strings that are equal, ignoring case, to the string 'true'
(following java.lang.Boolean/parseBoolean semantics)
sourceraw docstring

string->keywordclj/s

(string->keyword s)
source

string->uuidclj/s

Returns instance of UUID if input is a string. Note: in CLJS, this does not guarantee a specific UUID string representation, similar to #uuid reader

Returns instance of UUID if input is a string.
Note: in CLJS, this does not guarantee a specific UUID string representation,
      similar to #uuid reader
sourceraw docstring

string-coercion-matcherclj/s

(string-coercion-matcher schema)

A matcher that coerces keywords, keyword eq/enums, s/Num and s/Int, and long and doubles (JVM only) from strings.

A matcher that coerces keywords, keyword eq/enums, s/Num and s/Int,
and long and doubles (JVM only) from strings.
sourceraw docstring

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

× close