std.lib.transform.flatten

clean-output

added in 3.0

(clean-output data schema)

cleans ref keys in data

(clean-output {:id “student-a” :profile {:id “a” :name “Alice”}} (get-in -schema- :tree :student)) => {:id “student-a”, :profile :profile.id/a}

(clean-output {:id “math-5” :students []} (get-in -schema- :tree :class)) => {:id “math-5”}

flatten

added in 3.0

(flatten data schema)

converts a graph datastructure into a table

(flatten {:class {:id “maths-5” :name “MATHS 5” :students [{:id “student-a” :profile {:id “a” :name “Alice”}} {:id “student-b” :profile {:id “b” :name “Bob”}}]}} -schema-) => {:class {:id “maths-5”, :name “MATHS 5”}, :student [{:id “student-a”, :profile :profile.id/a, :class :class.id/maths-5} {:id “student-b”, :profile :profile.id/b, :class :class.id/maths-5}], :profile [{:id “a”, :name “Alice”} {:id “b”, :name “Bob”}]}

wrap-output

added in 3.0

(wrap-output f)

adding cleaned up data to table