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

     1  ### `nullif()` {#fn-nullif}
     2  
     3  Function prototype: `fn nullif(key, value)`
     4  
     5  Function description: If the content of the field specified by the extracted `key` is equal to the value of `value`, delete this field
     6  
     7  Function parameters:
     8  
     9  
    10  - `key`: specified field
    11  - `value`: target value
    12  
    13  Example:
    14  
    15  ```python
    16  # input data: {"first": 1,"second":2,"third":"aBC","forth":true}
    17  
    18  # script
    19  json(_, first) json(_, second) nullif(first, "1")
    20  
    21  # result
    22  {
    23      "second":2
    24  }
    25  ```
    26  
    27  > Note: This feature can be implemented with `if/else` semantics:
    28  
    29  ```python
    30  if first == "1" {
    31      drop_key(first)
    32  }
    33  ```
    34