Skip to content

transformQuery

Source Code | Documentation

See also: transformers

Transforms the query object.

ts
  import { 
transformQuery
} from 'feathers-utils/hooks';

Type declaration

ts
/**
 * Transforms the query object.
 */
export declare const transformQuery: <
  Q extends Query,
  H extends HookContext = HookContext,
>(
  transformer: TransformerFn<Q, H>,
) => (context: H, next?: NextFunction) => any
ArgumentTypeDescription
transformerTransformerFn<Q, H>
typemethodsmulti
before, after, aroundallyes

transformQuery is a hook that allows you to transform the query parameters before they are sent to the database. This can be useful for modifying the query structure, adding default values, or applying transformations to the query fields.

Transformers

'feathers-utils' provides a set of transformers that can be used with this hook. These transformers can be used to trim strings, convert dates, or omit fields from the query.

lowercase

Transforms the specified fields of an item to lowercase.

omit

Omit the specified fields from an item.

pick

Picks the specified fields from an item.

setNow

Sets the specified fields of an item to the current date and time.

trim

Trims the specified fields of an item.

Released under the MIT License.