postgrelize / CountWithOptions
Type Alias: CountWithOptions<T> ​
CountWithOptions<
T> =CountOptions<T> &Readonly<{group:string| readonlystring[]; }>
Defined in: src/model/find-options.ts:154
CountOptions with a required group, which makes Model.count resolve to one GroupedCountResultItem per group.
Type Parameters ​
T ​
T = Values
See ​
Example ​
ts
const opts: CountWithOptions<Post> = { group: ['authorId'] };
const perAuthor = await Post.count(opts); // [{ authorId, count }, ...]