Repository.CommandOptions
Repository.CommandOptions is the base options shape shared by every
Repository method — every other Repository.*Options interface
(CreateOptions, FindOptions, FindManyOptions, UpdateOptions, DeleteOptions, ...) extends
it. See Repositories for the full guide.
namespace Repository {
interface CommandOptions {
connection?: SqbConnection;
prettyPrint?: boolean;
comment?:
| string
| string[]
| { comment: string; dialect?: string[] }
| { comment: string; dialect?: string[] }[];
optimizerHint?:
| string
| string[]
| TableName.OptimizerHint
| TableName.OptimizerHint[];
}
}
| Option | Type | Description |
|---|---|---|
connection | SqbConnection | Run this call on a specific connection instead of acquiring one from the pool (e.g. inside a transaction). |
prettyPrint | boolean | Format the generated SQL for readability (useful when logging). |
comment | string | string[] | { comment: string; dialect?: string[] } | { comment: string; dialect?: string[] }[] | SQL comment(s) appended to the generated statement — the object form restricts a comment to specific dialects. |
optimizerHint | string | string[] | TableName.OptimizerHint | TableName.OptimizerHint[] | Dialect-specific optimizer hints applied to the query's TableName (TableName.OptimizerHint is exported by @sqb/builder). |
Extended by
Every method-specific options interface builds on CommandOptions, adding a projection
and/or filter/params pair (from two small, unexported helper interfaces internal to
repository.class.ts) as needed:
| Interface | Adds | Used by |
|---|---|---|
CreateOptions | projection?: string | string[] | create() |
CountOptions | filter?, params? | count() |
ExistsOptions | filter?, params? | exists() / existsOne() |
DeleteOptions | filter?, params? | delete() |
DeleteManyOptions | filter?, params? | deleteMany() |
FindOptions | projection?, filter?, params? | findById() |
FindOneOptions | FindOptions + sort?: string[], offset?: number | findOne() |
FindManyOptions | FindOneOptions + limit?, distinct?, maxEagerFetch?, maxSubQueries?, onTransformRow? — see Repository.FindManyOptions | findMany() |
UpdateOptions | projection?, filter?, params? | update() |
UpdateOnlyOptions | filter?, params? | updateOnly() |
UpdateManyOptions | filter?, params? | updateMany() |
filter/params follow the same syntax throughout — see
Repositories → Filters; projection follows
Repositories → Projection.