transformQuery
See also: transformers
Transforms the query object.
import { } from 'feathers-utils/hooks';Type declaration
/**
* Transforms the query object.
*
* @see https://utils.feathersjs.com/hooks/transform-query.html
*/
export declare const transformQuery: <
Q extends Query,
H extends HookContext = HookContext,
>(
transformer: TransformerFn<Q, H>,
) => (context: H, next?: NextFunction) => any| Argument | Type | Description |
|---|---|---|
| transformer | TransformerFn<Q, H> |
| type | methods | multi |
|---|---|---|
| before, after, around | all | yes |
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.
lowercaseTransforms the specified fields of an item to lowercase.
omitOmit the specified fields from an item.
parseDateParses the specified fields of an item into Date objects.
pickPicks the specified fields from an item.
setNowSets the specified fields of an item to the current date and time.
trimTrims the specified fields of an item.
