cuelang.org/go@v0.10.1/cue/testdata/eval/merge.txtar (about) 1 TODO: image field is not pre-evaluated (not a huge deal) 2 TODO: allow dynamic fields 3 4 -- in.cue -- 5 key: "app01" 6 manifests: [ 7 { 8 deployment: #map: [string]: {name: string, image: string, desc: string} 9 deployment: #map: "\(key)": name: "app01" 10 }, 11 { 12 deployment: #map: app01: image: "image01" 13 // TODO: allow 14 // deployment: #map: "\("app03")": image: "image01" 15 }, 16 ] 17 // unify 18 results: _ 19 for _, manifest in manifests { 20 results: manifest 21 } 22 -- out/eval/stats -- 23 Leaks: 0 24 Freed: 22 25 Reused: 15 26 Allocs: 7 27 Retain: 0 28 29 Unifications: 22 30 Conjuncts: 38 31 Disjuncts: 22 32 -- out/eval -- 33 (struct){ 34 key: (string){ "app01" } 35 manifests: (#list){ 36 0: (struct){ 37 deployment: (struct){ 38 #map: (#struct){ 39 app01: (#struct){ 40 name: (string){ "app01" } 41 image: (string){ string } 42 desc: (string){ string } 43 } 44 } 45 } 46 } 47 1: (struct){ 48 deployment: (struct){ 49 #map: (#struct){ 50 app01: (#struct){ 51 image: (string){ "image01" } 52 } 53 } 54 } 55 } 56 } 57 results: (struct){ 58 deployment: (struct){ 59 #map: (#struct){ 60 app01: (#struct){ 61 image: (string){ "image01" } 62 name: (string){ "app01" } 63 desc: (string){ string } 64 } 65 } 66 } 67 } 68 } 69 -- out/compile -- 70 --- in.cue 71 { 72 key: "app01" 73 manifests: [ 74 { 75 deployment: { 76 #map: { 77 [string]: { 78 name: string 79 image: string 80 desc: string 81 } 82 } 83 } 84 deployment: { 85 #map: { 86 "\(〈4;key〉)": { 87 name: "app01" 88 } 89 } 90 } 91 }, 92 { 93 deployment: { 94 #map: { 95 app01: { 96 image: "image01" 97 } 98 } 99 } 100 }, 101 ] 102 results: _ 103 for _, manifest in 〈0;manifests〉 { 104 results: 〈1;manifest〉 105 } 106 }