Liking cljdoc? Tell your friends :D
All platforms.

fooheads.rax.tree


rel->treeclj/s

(rel->tree rel mapping)
(rel->tree rel mapping opts)

tree->relclj/s

(tree->rel tree mapping)
(tree->rel tree mapping opts)

Maps a tree into a relation (a list of maps) using a mapping specification.

A tree is something that represents an aggregate or a list of aggregates, where a typical example could be an order and it's orderlines. A common place where you will find data of this shape is on web requests, where JSON data typically have this shape.

This function transforms a tree like that into a list of maps (which in relational algebra is called a relation); a flat data structure looking like a typical result set from a database.

Once you have the relation, you can continue your transformations in the list world, using relational algebra tools like clojure.set or fooheads.setish or by just using map/reduce/filter.

Each tuple (row) in the returned relation will always contains all keys/attrs that are specificed in the mapping. If the values does not exist in the tree, the resulting values will simply be nil.

See the tests for extensive examples of how to create mappings and what to expect from the transformation:

https://github.com/fooheads/rax/blob/main/test/fooheads/rax/tree_test.cljc

Maps a tree into a relation (a list of maps) using a mapping specification.

A tree is something that represents an aggregate or a list of aggregates,
where a typical example could be an order and it's orderlines. A common
place where you will find data of this shape is on web requests, where JSON
data typically have this shape.

This function transforms a tree like that into a list of maps (which in
relational algebra is called a relation); a flat data structure looking like
a typical result set from a database.

Once you have the relation, you can continue your transformations
in the list world, using relational algebra tools like clojure.set or
fooheads.setish or by just using map/reduce/filter.

Each tuple (row) in the returned relation will always contains all keys/attrs
that are specificed in the mapping. If the values does not exist in the tree,
the resulting values will simply be nil.

See the tests for extensive examples of how to create mappings and what
to expect from the transformation:

https://github.com/fooheads/rax/blob/main/test/fooheads/rax/tree_test.cljc
raw docstring

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

× close