( trx: DbTransaction, tableId: string, count: number, positions?: number[] )
| 309 | * `orderKeys` (handled before this function); here we just append a run. |
| 310 | */ |
| 311 | export async function resolveBatchInsertOrderKeys( |
| 312 | trx: DbTransaction, |
| 313 | tableId: string, |
| 314 | count: number, |
| 315 | positions?: number[] |
| 316 | ): Promise<string[]> { |
| 317 | if ( |
| 318 | !positions || |
| 319 | positions.length === 0 || |
| 320 | (await isFeatureEnabled('tables-fractional-ordering')) |
| 321 | ) { |
| 322 | return nKeysBetween(await maxOrderKey(trx, tableId), null, count) |
| 323 | } |
| 324 | const keys: string[] = [] |
| 325 | for (const pos of positions) { |
| 326 | keys.push(await resolveInsertOrderKey(trx, tableId, pos)) |
| 327 | } |
| 328 | return keys |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * Inserts a single row in its own transaction. Always assigns a fractional |
no test coverage detected