distinctOnTyped
Description
distinctOnTyped
is a method that applies typesafe distinctOn to a query in Postgres.
Signature
distinctOnTyped(
...distinctOn: KeyProxyCallback<Entity>
): SelectQueryBuilder<Entity>
Arguments
- distinctOn: KeyProxyCallback<Entity>: The array of callbacks which selects fields of entity for distingt rule.
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
)