st
Structural helpers
Schema
github.com/hofstadter.io/hof/flow/tasks/st
package st
Mask: {
@task(st.Mask)
val: _
mask: _
out: _
}
Pick: {
@task(st.Pick)
val: _
pick: _
out: _
}
Insert: {
@task(st.Insert)
val: _
insert: _
out: _
}
Replace: {
@task(st.Replace)
val: _
replace: _
out: _
}
Upsert: {
@task(st.Upsert)
val: _
upsert: _
out: _
}
Diff: {
@task(st.Diff)
orig: _
patch: diff
next: _
diff: _
}
Patch: {
@task(st.Patch)
orig: _
patch: _
next: _
diff: patch
}
Example
example
exec hof flow in.cue
cmp stdout golden.stdout
-- in.cue --
x: {
"a": {
"b": "B"
},
"b": 1
"c": 2
"d": "D"
}
y: {
a: {
b: string
}
c: int
d: "D"
}
@flow()
tasks: {
p1: { val: x, pick: y } @task(st.Pick)
m1: { val: p1.out, mask: { c: int } } @task(st.Mask)
m2: { val: p1.out, mask: { a: _ } } @task(st.Mask)
u1: { val: m1.out, upsert: m2.out } @task(st.Upsert) @print(out)
}
-- golden.stdout --
tasks.u1.out: {
a: {
b: "B"
}
d: "D"
c: 2
}