postgrelize / SelectOptions
Type Alias: SelectOptions ​
SelectOptions =
object
Defined in: src/model/select-options.ts:76
Options that shape a SELECT statement, shared by finders and copyTo.
Finders extend this with flags such as raw and include (FindOptions).
Example ​
const opts: SelectOptions = {
attributes: ['status', [fn('count', col('id')), 'n']],
group: ['status'],
having: { n: { [Op.gt]: 1 } },
order: [['status', 'DESC']],
limit: 20,
offset: 40,
};Properties ​
attributes? ​
optionalattributes?:FindAttributeOptions
Defined in: src/model/select-options.ts:80
Selected attributes. All attributes when omitted.
distinctOn? ​
optionaldistinctOn?: readonlyunknown[]
Defined in: src/model/select-options.ts:104
postgrelize extensionSELECT DISTINCT ON (...): attributes or expressions. PostgreSQL extension.
group? ​
optionalgroup?:unknown
Defined in: src/model/select-options.ts:84
GROUP BY attributes or expressions.
having? ​
optionalhaving?:unknown
Defined in: src/model/select-options.ts:86
HAVING condition.
limit? ​
optionallimit?:number|null
Defined in: src/model/select-options.ts:88
Maximum number of rows; null or undefined for no limit.
lock? ​
optionallock?:LockOption
Defined in: src/model/select-options.ts:92
Row lock (FOR UPDATE etc.); requires a transaction.
noWait? ​
optionalnoWait?:boolean
Defined in: src/model/select-options.ts:99
postgrelize extensionAdd NOWAIT to the row lock so the query fails instead of waiting; only with lock. PostgreSQL extension.
offset? ​
optionaloffset?:number|null
Defined in: src/model/select-options.ts:90
Number of rows to skip; null or undefined to skip none.
order? ​
Defined in: src/model/select-options.ts:82
Sort order: attribute names, [attribute, 'ASC' | 'DESC'] pairs or expressions.
sample? ​
optionalsample?:TableSampleOptions
Defined in: src/model/select-options.ts:115
postgrelize extensionRead only a random sample of the model table (TABLESAMPLE). PostgreSQL extension.
skipLocked? ​
optionalskipLocked?:boolean
Defined in: src/model/select-options.ts:94
Add SKIP LOCKED to the row lock; only with lock.
where? ​
optionalwhere?:unknown
Defined in: src/model/select-options.ts:78
Filter; finders type this as WhereOptions.
withTies? ​
optionalwithTies?:boolean
Defined in: src/model/select-options.ts:110
postgrelize extensionFETCH FIRST limit ROWS WITH TIES instead of LIMIT: also returns the rows that tie with the last one on the order columns. Needs limit and order. PostgreSQL extension.