UNPKG

cve-connector

Version:
30 lines (27 loc) 1.15 kB
/** * 查找条件 * - 逻辑运算符: '==''!=''in''not in',例如: ['年龄','>=',[18]] * - 数学选择器: '>''>=''<''<=',例如: ['血型','in',['A','B']] */ export type Condition = [ key: string, operation: LogicalOperation | MathicOperation, values: (string | number | boolean)[] ] type LogicalOperation = '==' | '!=' | 'in' | 'not in' type MathicOperation = '>' | '>=' | '<' | '<=' /** * Feature的查找条件,支持 Id、Name、Tags 三种模式 * - 按 Id 进行筛选,例如: { Id: ['Id-01','Id-02','Id-03'] } * - 按 Name 进行筛选,例如: { Name: ['Name-01','Name-02','Name-03'] } * - 按条件筛选,例如: { Tags: [ ["Age",">=",[18]], ["Job","in",["Tutor","Police"]] ], Operator:"And" } * - 筛选条件 Condition 的数据结构: [key, operation, values] * - Operation 为关系运算符,支持: '>''>=''<''<=''==''!=''in''not in' * - 多个条件需要指定 Operator 逻辑运算符,支持: 'And''Or' */ export interface Selector { Id?: string[] Name?: string[] Operator?: 'AND' | 'OR' Tags?: Condition[] }