Or come up with a better name. It should be able to compile and parse query strings. The compiler will construct a string with the given properties. I imagine this will be recursive. The parser will convert the string back into the original query object.
For example,
{
columns: ["first_name", "last_name", "email_address"],
filters: ["+last_name", ["email_address", "@gmail.com"]], // sorts the db query by `first_name` ascending `WHERE table.email_address = '% || ? ||%'`,
paginate: true,
}
Note: escape where needed. Most API tools, such as Paw or Postman, will automatically escape query strings, but we can't assume they will always properly escape
Or come up with a better name. It should be able to compile and parse query strings. The compiler will construct a string with the given properties. I imagine this will be recursive. The parser will convert the string back into the original query object.
For example,
should compile into
and should parse back into the original object.