postgrelize / CountOptions
Type Alias: CountOptions<T> ​
CountOptions<
T> =QueryOptionsBase&Readonly<{col?:string;distinct?:boolean;group?:string| readonlystring[];hooks?:boolean;include?:IncludeOption;paranoid?:boolean;sample?:TableSampleOptions;where?:WhereOptions<T>; }> &CteFindOptions
Defined in: src/model/find-options.ts:116
Options of count.
Includes joins and CTE options; count fires beforeCount hooks.
Type Parameters ​
T ​
T = Values
See ​
Example ​
ts
const total = await Post.count({ where: { published: true }, distinct: true, col: 'authorId' });
const opts: CountOptions<Post> = { group: 'authorId' };
const perAuthor = await Post.count(opts); // [{ authorId, count }, ...]