getFilterValue

the getFilterValue it returns the filter value based on the key and the value type.

Example with comparison operator

it extracts the comparison operator from the key and mount the value based on it.

import { getFilterValue } from '@ra-libs/nestjs';

const value = getFilterValue('age__gt', 18);

the value will be

{
    "gt": 18
}

the getFilterValue supports these prisma operators

  • gt

  • gte

  • lt

  • lte

  • not

  • int

Example with array value

the value will be

Example with boolean value

the value will be

Any other value type

the value will be

Last updated