How can I implement a "starts_with" filter?

System Information
  • Strapi Version: 3.4.0
  • Database: PostgresDB


I need to implement a “starts_with” filter so that I can query every entry with a name that starts with an “A” or a “B” etc.

Is there a way I can create my own filter?

I’m sorry to “up” this post. But I’m still blocked.

So I’m trying to implement a custom query.

In my service file:

 module.exports = {
  find(params, populate) {
    return strapi.query("restaurant").find(params, populate);

Concretely, how can I extend this find function (or find its source code) to add my starts_with filter? I know that with Bookshelf I can do something like:

  await strapi
    .model.query(qb => {
      qb.where('id', "like", `${params.name_starts_with}%`);

But I’m missing a brick. I need the source code of strapi.query("restaurant").find(params, populate);