Skip to content

postgrelize / CountWithOptions

Type Alias: CountWithOptions<T> ​

CountWithOptions<T> = CountOptions<T> & Readonly<{ group: string | readonly string[]; }>

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 ​

Model.count

Example ​

ts
const opts: CountWithOptions<Post> = { group: ['authorId'] };
const perAuthor = await Post.count(opts); // [{ authorId, count }, ...]

Released under the MIT License.