(slot: number)
| 195 | ): Promise<string> { |
| 196 | const fractionalOrdering = await isFeatureEnabled('tables-fractional-ordering') |
| 197 | const orderKeyAtSlot = async (slot: number): Promise<string | null> => { |
| 198 | if (slot < 0) return null |
| 199 | if (fractionalOrdering) { |
| 200 | const [r] = await trx |
| 201 | .select({ orderKey: userTableRows.orderKey }) |
| 202 | .from(userTableRows) |
| 203 | .where(eq(userTableRows.tableId, tableId)) |
| 204 | .orderBy(asc(userTableRows.orderKey), asc(userTableRows.id)) |
| 205 | .limit(1) |
| 206 | .offset(slot) |
| 207 | return r?.orderKey ?? null |
| 208 | } |
| 209 | const [r] = await trx |
| 210 | .select({ orderKey: userTableRows.orderKey }) |
| 211 | .from(userTableRows) |
| 212 | .where(and(eq(userTableRows.tableId, tableId), eq(userTableRows.position, slot))) |
| 213 | .limit(1) |
| 214 | return r?.orderKey ?? null |
| 215 | } |
| 216 | if (requestedPosition === undefined) { |
| 217 | return keyBetween(await maxOrderKey(trx, tableId), null) |
| 218 | } |
no test coverage detected