Skip to main content

distinctOnTyped

Description

distinctOnTyped is a method that applies typesafe distinctOn to a query in Postgres.

Signature

distinctOnTyped(
...distinctOn: KeyProxyCallback<Entity>
): SelectQueryBuilder<Entity>

Arguments

Usage

// same as `query.distinctOn(['user.name'])`
query.distinctOnTyped(user => user.name)
// same as `query.distinctOn(['user.id', 'user.name'])`
query.distinctOnTyped(user => [
user.createdAt,
user.name,
])
// same as `query.distinctOn(['user.createdAt', 'user.name'])`
query.distinctOnTyped(
user => user.createdAt,
user => user.name
)