(is-query datasource)checks if datasource is a query command
(is-query {:command :query}) => true
checks if datasource is a query command
(is-query {:command :query})
=> true(is-set attr datasource)checks if the data needs to be contained within a set
(is-set {:cardinality :many} {}) => true
(is-set {} {:command :query}) => true
checks if the data needs to be contained within a set
(is-set {:cardinality :many} {})
=> true
(is-set {} {:command :query})
=> true(wrap-attr-set f)wraps normalise to type check inputs as well as to coerce incorrect inputs
(pipeline/normalise {:account {:tags "10"}} {:schema (schema/schema examples/account-orders-items-image)} {:normalise-attr [wrap-attr-set]}) => {:account {:tags #{"10"}}}
(pipeline/normalise {:account {:user #{"andy" "bob"}}} {:schema (schema/schema examples/account-orders-items-image)} {:normalise-attr [wrap-attr-set]}) => (throws-info {:normalise true, :wrong-input true, :data #{"bob" "andy"}, :nsv [:account :user], :key-path nil})
(pipeline/normalise {:account {:user #{"andy" "bob"}}} {:schema (schema/schema examples/account-orders-items-image) :command :query} {:normalise-attr [wrap-attr-set]}) => {:account {:user #{"bob" "andy"}}}
wraps normalise to type check inputs as well as to coerce incorrect inputs
(pipeline/normalise {:account {:tags "10"}}
{:schema (schema/schema examples/account-orders-items-image)}
{:normalise-attr [wrap-attr-set]})
=> {:account {:tags #{"10"}}}
(pipeline/normalise {:account {:user #{"andy" "bob"}}}
{:schema (schema/schema examples/account-orders-items-image)}
{:normalise-attr [wrap-attr-set]})
=> (throws-info {:normalise true,
:wrong-input true,
:data #{"bob" "andy"},
:nsv [:account :user],
:key-path nil})
(pipeline/normalise {:account {:user #{"andy" "bob"}}}
{:schema (schema/schema examples/account-orders-items-image)
:command :query}
{:normalise-attr [wrap-attr-set]})
=> {:account {:user #{"bob" "andy"}}}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |