• Function to transform @axinom/mosaic-ui FilterValues to PostGraphile filters

    Type Parameters

    Parameters

    • filters: FilterValues<unknown>

      FilterValues from @axinom/mosaic-ui

    • map: FilterMap<T>

      Object containing paths of PostGraphile filters.

    Returns undefined | T

    Example

    filterToPostGraphileFilter<MovieFilter>(filters, {
    title: 'includes', // Resolves to {title: {includes: ${value}}}
    tags: ['some', 'name', 'includes'] // Resolves to {tags: {some: {name: {includes: ${value}}}}}
    createdDate: value => {
    const values = String(value).split('|');
    return {
    greaterThan: values[0],
    lessThan: values[1],
    };
    }, // Resolves to {createdDate: {greaterThan: ${values[0]}, lessThan: ${values[1]}}}
    };

Generated using TypeDoc