two styles for feathers hooks

Jul 24, 11:27 AM

https://knexjs.org/guide/query-builder.html#knex

module.exports = (options = {}) => {
  return async context => {
        context.params.query = {                        // added by mark
          ...context.params.query,                      // added by mark
          $select: ['clientStimwordNotes']              // added by mark
        }                                               // added by mark
    return context;
  };
};
to completely rewrite the query:
module.exports = (options = {}) => {
  return async context => {

        const query = context.service.createQuery(context.params);
        const knexClient =   context.app.get(‘knexClient’) ;
        query   .clear(‘select’)
                .select  (   ‘col_4’  
                         ,  { ‘my Column’    ,   `col0’  }
                         ,  knexClient.raw(“CONCAT AS col1_2”)
                          )
                .distinct()
                .orderBy(‘languageNormsName’)
                ;
        context.params.knex = query

    return context;
  };
};
notice the THREE different styles of selection.
Mark Edwards

,

---

Commenting is closed for this article.

---