I'm using Apollo to make requests to my GraphQL server.
My query is like below:
export const QUERY_ITEMS = gql`
query get_items($date: date) {
items(where: {date: {_eq: $date}}) {
name
}
}
`;
const {data} = useQuery(QUERY_ITEMS, variable: {date: '2020-01-01'});
Notice how right now the _eq
operator is hardcoded. I'm implementing a feature where I'm making that operator dynamic to enable things like '_gt'
and '_lt'
.How can I achieve this?