github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/get_key.en.md (about)

     1  ### `get_key()` {#fn-get-key}
     2  
     3  Function prototype: `fn get_key(key)`
     4  
     5  Function description: Read the value of key from the input point
     6  
     7  Function parameters:
     8  
     9  - `key_name`: key name
    10  
    11  Example:
    12  
    13  ```python
    14  add_key("city", "shanghai")
    15  
    16  # Here you can directly access the value of the key with the same name in point through city
    17  if city == "shanghai" {
    18    add_key("city_1", city)
    19  }
    20  
    21  # Due to the right associativity of assignment, get the value whose key is "city" first,
    22  # Then create a variable named city
    23  city = city + " --- ningbo" + " --- " +
    24      "hangzhou" + " --- suzhou ---" + ""
    25  
    26  # get_key gets the value of "city" from point
    27  # If there is a variable named city, it cannot be obtained directly from point
    28  if city != get_key("city") {
    29    add_key("city_2", city)
    30  }
    31  
    32  # result
    33  """
    34  {
    35    "city": "shanghai",
    36    "city_1": "shanghai",
    37    "city_2": "shanghai --- ningbo --- hangzhou --- suzhou ---"
    38  }
    39  """
    40  ```