1// Copyright 2023 The Pigweed Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); you may not 4// use this file except in compliance with the License. You may obtain a copy of 5// the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12// License for the specific language governing permissions and limitations under 13// the License. 14 15export enum ConditionType { 16 StringSearch, 17 ColumnSearch, 18 ExactPhraseSearch, 19 AndExpression, 20 OrExpression, 21 NotExpression, 22} 23 24export type StringSearchCondition = { 25 type: ConditionType.StringSearch; 26 searchString: string; 27}; 28 29export type ColumnSearchCondition = { 30 type: ConditionType.ColumnSearch; 31 column: string; 32 value?: string; 33}; 34 35export type ExactPhraseSearchCondition = { 36 type: ConditionType.ExactPhraseSearch; 37 exactPhrase: string; 38}; 39 40export type AndExpressionCondition = { 41 type: ConditionType.AndExpression; 42 expressions: FilterCondition[]; 43}; 44 45export type OrExpressionCondition = { 46 type: ConditionType.OrExpression; 47 expressions: FilterCondition[]; 48}; 49 50export type NotExpressionCondition = { 51 type: ConditionType.NotExpression; 52 expression: FilterCondition; 53}; 54 55export type FilterCondition = 56 | ColumnSearchCondition 57 | StringSearchCondition 58 | ExactPhraseSearchCondition 59 | AndExpressionCondition 60 | OrExpressionCondition 61 | NotExpressionCondition; 62