(parse-pattern pattern)Parse an EDN pull pattern into a tree of records using the following grammar:
pattern = [attr-spec+]
attr-spec = attr-name | wildcard | map-spec | attr-expr
attr-name = an edn keyword that names an attr
wildcard = "*" or '*'
map-spec = { ((attr-name | attr-expr) (pattern | recursion-limit))+ }
attr-expr = attr-with-opts | legacy-attr-expr
attr-with-opts = [attr-name attr-option+]
attr-option = :as any-value | :limit (positive-number | nil) | :default any-value
recursion-limit = positive-number | '...'
legacy-attr-expr = legacy-limit-expr | legacy-default-expr
legacy-limit-expr = [("limit" | 'limit') attr-name (positive-number | nil)]
legacy-default-expr = [("default" | 'default') attr-name any-value]
Parse an EDN pull pattern into a tree of records using the following
grammar:
```
pattern = [attr-spec+]
attr-spec = attr-name | wildcard | map-spec | attr-expr
attr-name = an edn keyword that names an attr
wildcard = "*" or '*'
map-spec = { ((attr-name | attr-expr) (pattern | recursion-limit))+ }
attr-expr = attr-with-opts | legacy-attr-expr
attr-with-opts = [attr-name attr-option+]
attr-option = :as any-value | :limit (positive-number | nil) | :default any-value
recursion-limit = positive-number | '...'
legacy-attr-expr = legacy-limit-expr | legacy-default-expr
legacy-limit-expr = [("limit" | 'limit') attr-name (positive-number | nil)]
legacy-default-expr = [("default" | 'default') attr-name any-value]
```(parse-pull pattern)Parse EDN pull pattern specification (see parse-pattern), and
convert the resulting tree into a PullSpec instance (see pattern->spec).
Throws an error if the supplied pattern cannot be parsed.
Parse EDN pull `pattern` specification (see `parse-pattern`), and convert the resulting tree into a `PullSpec` instance (see `pattern->spec`). Throws an error if the supplied `pattern` cannot be parsed.
(pattern->spec pattern)Convert a parsed tree of pull pattern records into a PullSpec instance,
a record type containing two keys:
:wildcard? - a boolean indicating if the pattern contains a wildcard.:attrs - a map of attribute specifications.The attribute specification map consists of keys which will become the keys in the result map, and values which are themselves maps describing the attribute:
:attr (required) - The attr name to pull; for reverse attributes
this will be the normalized attribute name.:as (optional) - Alias, any:limit (optional) - If present, specifies a custom limit for this
attribute; Either nil, indicating no limit,
or a positive integer.:default (optional) - If present, specifies a default value for this
attribute:recursion (optional) - If present, specifies a recursion limit for this
attribute; Either nil, indicating no limit, or
a positive integer.:subpattern (optional) - If present, specifies a sub PullSpec instance
to be applied to entities matched by this
attribute.Convert a parsed tree of pull pattern records into a `PullSpec` instance,
a record type containing two keys:
* `:wildcard?` - a boolean indicating if the pattern contains a wildcard.
* `:attrs` - a map of attribute specifications.
The attribute specification map consists of keys which will become the keys
in the result map, and values which are themselves maps describing the
attribute:
* `:attr` (required) - The attr name to pull; for reverse attributes
this will be the normalized attribute name.
* `:as` (optional) - Alias, any
* `:limit` (optional) - If present, specifies a custom limit for this
attribute; Either `nil`, indicating no limit,
or a positive integer.
* `:default` (optional) - If present, specifies a default value for this
attribute
* `:recursion` (optional) - If present, specifies a recursion limit for this
attribute; Either `nil`, indicating no limit, or
a positive integer.
* `:subpattern` (optional) - If present, specifies a sub `PullSpec` instance
to be applied to entities matched by this
attribute.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 |