github.com/solo-io/cue@v0.4.7/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 --
    21  (struct){
    22    DeleteThis: (#list){
    23      0: (string){ "this" }
    24      1: (string){ "that" }
    25    }
    26    useful_infra: (struct){
    27      gcp: (struct){
    28        cluters: (int){ 10 }
    29      }
    30      aws: (struct){
    31        clusters: (int){ 20 }
    32      }
    33      this: (struct){
    34        clusters: (int){ 1 }
    35      }
    36      that: (struct){
    37        clusters: (int){ 2 }
    38      }
    39    }
    40    New_infra: (struct){
    41      gcp: (struct){
    42        cluters: (int){ 10 }
    43      }
    44      aws: (struct){
    45        clusters: (int){ 20 }
    46      }
    47    }
    48  }
    49  -- out/compile --
    50  --- in.cue
    51  {
    52    DeleteThis: [
    53      "this",
    54      "that",
    55    ]
    56    useful_infra: {
    57      gcp: {
    58        cluters: 10
    59      }
    60      aws: {
    61        clusters: 20
    62      }
    63      this: {
    64        clusters: 1
    65      }
    66      that: {
    67        clusters: 2
    68      }
    69    }
    70    New_infra: {
    71      for k, v in 〈1;useful_infra〉 {
    72        if !〈import;list〉.Contains(〈3;DeleteThis〉, 〈1;k〉) {
    73          "\(〈2;k〉)": 〈2;v〉
    74        }
    75      }
    76    }
    77  }