How to use _like with '%' in a graphql string?
114
just store you value inside another variable and then use that variable with ${variable} inside the graphql query it will help you
Author by
Serus
Updated on January 02, 2023Comments
-
Serus over 1 year
I'm using flutter with graphql/client library. I'm trying to create a string for a gql query that has a where condition:
const getUsers = """ query getUsers(\$nameToSearch: String!) { users(where: {name: {_ilike: %\$nameToSearch%}}) { id name } } """;
the problem is that I don't know how to insert the '%' symbol in that string... the example is wrong and I tried all the combinations. Online I found only basic examples that doesn't use the '%' symbol
What is the correct syntax?
-
Sam Chan over 2 yearsI think the question is more relate to
graphql
and you may find answer from https://stackoverflow.com/questions/37981269/how-to-search-string-values-in-graphql
-
-
Serus over 2 yearsI would like to use the 'variables' parameter in query options to pass the variables to avoid injections... at the moment i solved building the string in the classic way but I'm pretty sure that it isn't the correct way