Debian Codegraph @

ex/deep7

raw
1 {
2 _ => [
3 'tree_table', -join => {
4 as => 'tree',
5 on => { 'tree.id' => 'tree_with_path.id' },
6 to => { -select => {
7 from => 'tree_with_path',
8 select => '*',
9 with_recursive => [
10 [ 'tree_with_path', 'id', 'parent_id', 'path' ], { -select => {
11 _ => [
12 'id', 'parent_id', { -as =>
13 [
14 { -cast => { -as => [ 'id', 'char', 255 ] } },
15 'path',
16 ]
17 },
18 ],
19 from => 'tree_table',
20 union_all => { -select => {
21 _ => [
22 't.id', 't.parent_id', { -as => [
23 { -concat => [ 'r.path', \"'/'", 't.id' ] },
24 'path',
25 ] },
26 ],
27 from => [
28 'tree_table', -as => 't', -join => {
29 as => 'r',
30 on => { 't.parent_id' => 'r.id' },
31 to => 'tree_with_path',
32 },
33 ],
34 } },
35 where => { parent_id => undef },
36 } },
37 ],
38 } },
39 },
40 ],
41 set => { path => { -ident => [ 'tree', 'path' ] } },
42 }