import { QueryType, getSearchDateRange, getSearchInfo } from 'util/query'

getSearchInfo({
    query: {
        value: '123',
        text: '123',
        code: 'abc',
        check: ['1', '2', '3'],
        range: [1, 10],
        dateRange: getSearchDateRange(['2021-01-01', '2021-01-10'])
    },
    queryType: {
        text: QueryType.Equal,
        code: QueryType.Like,
        check: QueryType.Equal,
        range: [QueryType.GreaterThanOrEqual, QueryType.LessThan],
        dateRange: [QueryType.GreaterThanOrEqual, QueryType.LessThan]
    }
})

// =>

[
    { field: 'value', value: ['123'] },
    { field: 'text', value: ['123'], type: '=' },
    { field: 'code', value: ['abc'], type: 'like' },
    { field: 'check', value: ['1', '2', '3'], type: '=' },
    { field: 'range', value: [1], type: '>=' },
    { field: 'range', value: [10], type: '<' },
    { field: 'dateRange', value: ['2021-01-01'], type: '>=' },
    { field: 'dateRange', value: ['2021-01-11'], type: '<' }
]