1 | /// <reference types="mongoose/types/aggregate" />
|
2 | /// <reference types="mongoose/types/callback" />
|
3 | /// <reference types="mongoose/types/collection" />
|
4 | /// <reference types="mongoose/types/connection" />
|
5 | /// <reference types="mongoose/types/cursor" />
|
6 | /// <reference types="mongoose/types/document" />
|
7 | /// <reference types="mongoose/types/error" />
|
8 | /// <reference types="mongoose/types/expressions" />
|
9 | /// <reference types="mongoose/types/helpers" />
|
10 | /// <reference types="mongoose/types/middlewares" />
|
11 | /// <reference types="mongoose/types/indexes" />
|
12 | /// <reference types="mongoose/types/models" />
|
13 | /// <reference types="mongoose/types/mongooseoptions" />
|
14 | /// <reference types="mongoose/types/pipelinestage" />
|
15 | /// <reference types="mongoose/types/populate" />
|
16 | /// <reference types="mongoose/types/query" />
|
17 | /// <reference types="mongoose/types/schemaoptions" />
|
18 | /// <reference types="mongoose/types/schematypes" />
|
19 | /// <reference types="mongoose/types/session" />
|
20 | /// <reference types="mongoose/types/types" />
|
21 | /// <reference types="mongoose/types/utility" />
|
22 | /// <reference types="mongoose/types/validation" />
|
23 | /// <reference types="mongoose/types/virtuals" />
|
24 | /// <reference types="mongoose/types/inferschematype" />
|
25 | /// <reference types="mongoose/types/inferrawdoctype" />
|
26 | import type { Query } from 'mongoose';
|
27 | import type { AnyParamConstructor, QueryHelperThis } from './types';
|
28 | /**
|
29 | * Adds a query method to the Class which will then be added to the Schema.
|
30 | * @param func The Query Method to add
|
31 | * @example
|
32 | * ```ts
|
33 | * interface FindHelpers {
|
34 | * findByTitle: AsQueryMethod<typeof findByTitle>;
|
35 | * }
|
36 | *
|
37 | * function findByTitle(this: ReturnModelType<typeof Event, FindHelpers>, title: string) {
|
38 | * return this.find({ title });
|
39 | * }
|
40 | *
|
41 | * @queryMethod(findByTitle)
|
42 | * class Event {
|
43 | * @prop()
|
44 | * public title: string;
|
45 | * }
|
46 | *
|
47 | * const EventModel = getModelForClass<typeof Event, FindHelpers>(Event);
|
48 | * ```
|
49 | */
|
50 | export declare function queryMethod<QueryHelpers, U extends AnyParamConstructor<any>>(func: (this: QueryHelperThis<U, QueryHelpers>, ...params: any[]) => Query<any, any>): ClassDecorator;
|
51 | export { queryMethod as QueryMethod };
|