Skip to content

Commit 7b2e348

Browse files
authored
Merge pull request #74 from filipedtristao/query_static_method
Add possibility to call query method statically
2 parents 53712b6 + 012c7a3 commit 7b2e348

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Model.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,16 @@ export abstract class Model
9797
*/
9898
public query(): Builder
9999
{
100-
return new Builder(this.constructor);
100+
return this.constructor.query();
101+
}
102+
103+
/**
104+
* Get a {@link Builder} instance from a static {@link Model}
105+
* so you can start querying
106+
*/
107+
public static query(): Builder
108+
{
109+
return new Builder(this);
101110
}
102111

103112
public static get(page?: number): Promise<PluralResponse>

0 commit comments

Comments
 (0)