(->transformer)
(->transformer {:keys [transformations] :as config})
Creates a new Transformer
instance from given map of adjacencies and related configuration. By default uses
[[default-adjacencies]], but the map of adjacency lists to validation and transformation functions can be overridden.
; create new transformer with built-in defaults:
(def defaults-t (->transformer))
; create new transformer with custom transformation configuration:
(def custom-t (-> transformer {:transformations [:keyword :string] {:validator keyword?
:transformer name}
[:string :number] {:validator string?
:transformer parse-long}})
Creates a new [[Transformer]] instance from given map of adjacencies and related configuration. By default uses [[default-adjacencies]], but the map of adjacency lists to validation and transformation functions can be overridden. ```clojure ; create new transformer with built-in defaults: (def defaults-t (->transformer)) ; create new transformer with custom transformation configuration: (def custom-t (-> transformer {:transformations [:keyword :string] {:validator keyword? :transformer name} [:string :number] {:validator string? :transformer parse-long}}) ```
Collection of default type transformations.
See also [[transform]]
Collection of default type transformations. See also [[transform]]
Transformer defines an encapsulated relation between possible transformation steps represented as adjacency list, the digraph they form and user space API for working with the data.
Transformer defines an encapsulated relation between possible transformation steps represented as adjacency list, the digraph they form and user space API for working with the data.
(config this)
Return the original configuration this transformer was created with.
Return the original configuration this transformer was created with.
(transform this from to value)
Tries to transform given value
between given types. The type pair from
and to
does not have to be directly
known but must be resolvable into a transformation chain.
If path between the types is not found, special value ::unknown-path
is returned.
If value cannot be transformed with the resolved chain, special value ::invalid-value
is returned.
Tries to transform given `value` between given types. The type pair `from` and `to` does not have to be directly known but must be resolvable into a transformation chain. If path between the types is not found, special value `::unknown-path` is returned. If value cannot be transformed with the resolved chain, special value `::invalid-value` is returned.
(visualize-dot this)
Render the contained graph out as DOT document. Returns the result as string.
Render the contained graph out as DOT document. Returns the result as string.
(visualize-mermaid this)
Render the contained graph out as Mermaid Flowchart. Returns the result as string.
Render the contained graph out as Mermaid Flowchart. Returns the result as string.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close