github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/demo/18_from_excel.yaml (about)

     1  fields:
     2  #  - field: field_use_excel                # 从excel数据源里面取数据。
     3  #    from: city.v1.city                    # 从data/address/v1.xlsx文件中读取名为china的工作簿。
     4  #    select: name                          # 查询city字段。
     5  #    where: state like '%山东%'             # 条件是省份包含山东。
     6  #    rand: true                            # 随机取数据
     7  #    postfix: "\t"
     8  
     9    - field: columns                        # 变量,从excel中读取的列。如果命令指定-F参数,需要包含以避免忽略处理。
    10      range: name
    11      postfix: "\t"
    12      length: 12
    13  
    14    - field: conditions                     # 变量,用于where条件里。如果命令指定-F参数,需要包含以避免忽略处理。
    15      range: [山东,江苏]
    16      postfix: "\t"
    17  
    18    - field: field_use_excel_expr           # 基于变量表达式的excel查询。
    19      from: city.v1.city
    20      select: ${columns}                    # 选择不同的列,此处columns变量有两个值,各占返回记录的50%。
    21      where: state like '%${conditions}%'   # 使用不同的变量值,此处conditions变量有两个值,各占返回记录的50%。
    22      postfix: "\t"