I have adonis back end (that run knex under the hood) that sending some data to front end according user filtering.
I need to implement one of the filtering parameters with something like startWith
js method, to check if the text that user submitted is the beginning of the name of data at backend, and not appears in the middle of it
Currently I using
this.where('companies.name', 'like', params.name)
What checks also for middle appearance.
Ideally I want to do something like
this.where('companies.name', 'startWith', params.name)
But this syntax is invalid.
Are there is something similar to this use case? Couldn't find something in Knex doc that seems to do the trick for my issue
Just for clarify, I join few tables in this query and do some where
filtering, so a solution follow this syntax will be the best, but open for more solutions
Thanks in advance!