cuelang.org/go@v0.10.1/cue/testdata/comprehensions/nestembed.txtar (about) 1 Issue #556 2 3 -- in.cue -- 4 import "list" 5 6 DeleteThis: ["this", "that"] 7 useful_infra: { 8 gcp: cluters: 10 9 aws: clusters: 20 10 this: clusters: 1 11 that: clusters: 2 12 } 13 New_infra: { 14 for k, v in useful_infra { 15 if !list.Contains(DeleteThis, k) { 16 "\(k)": v 17 } 18 } 19 } 20 -- out/eval/stats -- 21 Leaks: 0 22 Freed: 18 23 Reused: 14 24 Allocs: 4 25 Retain: 0 26 27 Unifications: 18 28 Conjuncts: 26 29 Disjuncts: 18 30 -- out/eval -- 31 (struct){ 32 DeleteThis: (#list){ 33 0: (string){ "this" } 34 1: (string){ "that" } 35 } 36 useful_infra: (struct){ 37 gcp: (struct){ 38 cluters: (int){ 10 } 39 } 40 aws: (struct){ 41 clusters: (int){ 20 } 42 } 43 this: (struct){ 44 clusters: (int){ 1 } 45 } 46 that: (struct){ 47 clusters: (int){ 2 } 48 } 49 } 50 New_infra: (struct){ 51 gcp: (struct){ 52 cluters: (int){ 10 } 53 } 54 aws: (struct){ 55 clusters: (int){ 20 } 56 } 57 } 58 } 59 -- out/compile -- 60 --- in.cue 61 { 62 DeleteThis: [ 63 "this", 64 "that", 65 ] 66 useful_infra: { 67 gcp: { 68 cluters: 10 69 } 70 aws: { 71 clusters: 20 72 } 73 this: { 74 clusters: 1 75 } 76 that: { 77 clusters: 2 78 } 79 } 80 New_infra: { 81 for k, v in 〈1;useful_infra〉 { 82 if !〈import;list〉.Contains(〈3;DeleteThis〉, 〈1;k〉) { 83 "\(〈2;k〉)": 〈2;v〉 84 } 85 } 86 } 87 }