Liking cljdoc? Tell your friends :D

hara.data.pipeline.fill-empty


process-fill-emptyclj

(process-fill-empty sfill tdata nsv interim tsch datasource)

helper functio for wrap-model-fill-empty

(process-fill-empty {:age 10} {:name "Chris"} [:account] {} (-> (schema/schema examples/account-name-age-sex) :tree :person) {}) => {:name "Chris", :age 10}

helper functio for wrap-model-fill-empty

 (process-fill-empty {:age 10}
                     {:name "Chris"}
                     [:account]
                     {}
                     (-> (schema/schema examples/account-name-age-sex)
                         :tree
                         :person)
                     {})
=> {:name "Chris", :age 10}
raw docstring

wrap-model-fill-emptyclj

(wrap-model-fill-empty f)

fill empty entry with either value or function

(pipeline/normalise {:account/name "Chris"} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:fill-empty {:account {:age 10}}}} {:normalise [wrap-model-fill-empty]}) => {:account {:name "Chris", :age 10}}

(pipeline/normalise {:account/name "Chris"} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:fill-empty {:account {:age (fn [_ datasource] (:age datasource))}}} :age 10} {:normalise [wrap-model-fill-empty]}) => {:account {:name "Chris", :age 10}}

(pipeline/normalise {:account/name "Chris" :account/age 9} {:schema (schema/schema examples/account-name-age-sex) :pipeline {:fill-empty {:account {:age 10}}}} {:normalise [wrap-model-fill-empty]}) => {:account {:name "Chris" :age 9}}

fill empty entry with either value or function

(pipeline/normalise {:account/name "Chris"}
                    {:schema (schema/schema examples/account-name-age-sex)
                      :pipeline {:fill-empty {:account {:age 10}}}}
                     {:normalise [wrap-model-fill-empty]})
=> {:account {:name "Chris", :age 10}}

(pipeline/normalise {:account/name "Chris"}
                    {:schema (schema/schema examples/account-name-age-sex)
                     :pipeline {:fill-empty {:account {:age (fn [_ datasource]
                                                              (:age datasource))}}}
                     :age 10}
                    {:normalise [wrap-model-fill-empty]})
=> {:account {:name "Chris", :age 10}}

(pipeline/normalise {:account/name "Chris" :account/age 9}
                     {:schema (schema/schema examples/account-name-age-sex)
                      :pipeline {:fill-empty {:account {:age 10}}}}
                     {:normalise [wrap-model-fill-empty]})
=> {:account {:name "Chris" :age 9}}
raw docstring

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

× close