Skip to content

Commit d339c0e

Browse files
refactor(tables): consolidate executor types onto planner exports
service.ts kept a private DbTransaction alias and two inline typeof db | DbTransaction unions after planner.ts began exporting the canonical DbTransaction/DbExecutor — import those instead. From the /simplify review of the perf series; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d0abf3e commit d339c0e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

apps/sim/lib/table/service.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { COLUMN_TYPES, NAME_PATTERN, TABLE_LIMITS, USER_TABLE_ROWS_SQL_NAME } fr
4444
import { areGroupDepsSatisfied } from './deps'
4545
import { CSV_MAX_BATCH_SIZE } from './import'
4646
import { keyBetween, nKeysBetween } from './order-key'
47-
import { withSeqscanOff } from './planner'
47+
import { type DbExecutor, type DbTransaction, withSeqscanOff } from './planner'
4848
import { buildFilterClause, buildSortClause, escapeLikePattern } from './sql'
4949
import { fireTableTrigger } from './trigger'
5050
import type {
@@ -115,8 +115,6 @@ export class TableConflictError extends Error {
115115

116116
export type TableScope = 'active' | 'archived' | 'all'
117117

118-
type DbTransaction = Parameters<Parameters<typeof db.transaction>[0]>[0]
119-
120118
/**
121119
* Sets per-transaction Postgres timeouts via `SET LOCAL`.
122120
*
@@ -1607,7 +1605,7 @@ export async function selectRowIdPage(params: {
16071605
limit: number
16081606
}): Promise<string[]> {
16091607
const { tableId, workspaceId, cutoff, filterClause, afterId, limit } = params
1610-
const selectPage = (executor: typeof db | DbTransaction) =>
1608+
const selectPage = (executor: DbExecutor) =>
16111609
executor
16121610
.select({ id: userTableRows.id })
16131611
.from(userTableRows)
@@ -2915,7 +2913,7 @@ export async function queryRows(
29152913
)
29162914
: whereClause
29172915

2918-
const buildPageQuery = (executor: typeof db | DbTransaction) => {
2916+
const buildPageQuery = (executor: DbExecutor) => {
29192917
const query = executor
29202918
.select()
29212919
.from(userTableRows)

0 commit comments

Comments
 (0)