fix(db): correct dialect import paths and extend bip-users-dao type

- Fix dialect files to use relative paths instead of @types alias
- Add 'postgresql' to BIPUsersDAO dbType union

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-04-05 10:34:03 +08:00
parent 54a3ac680a
commit 0ca17a1807
5 changed files with 22 additions and 40 deletions

View File

@@ -8,7 +8,7 @@
* - OFFSET/FETCH pagination
*/
import type { SqlDialect } from '@types/sql-dialect.types'
import type { SqlDialect } from '../../../types/sql-dialect.types'
export class SqlServerDialect implements SqlDialect {
readonly dbType = 'sqlserver' as const
@@ -37,19 +37,13 @@ export class SqlServerDialect implements SqlDialect {
}): { sql: string; nextParamIndex: number } {
const { table, keyColumns, allColumns, startParamIndex } = params
const valueParams = allColumns
.map((_, i) => `@p${startParamIndex + i}`)
.join(', ')
const valueParams = allColumns.map((_, i) => `@p${startParamIndex + i}`).join(', ')
const sourceColumns = allColumns.join(', ')
const joinCondition = keyColumns
.map((col) => `target.${col} = source.${col}`)
.join(' AND ')
const joinCondition = keyColumns.map((col) => `target.${col} = source.${col}`).join(' AND ')
const nonKeyColumns = allColumns.filter((col) => !keyColumns.includes(col))
const updateSet = nonKeyColumns
.map((col) => `target.${col} = source.${col}`)
.join(', ')
const updateSet = nonKeyColumns.map((col) => `target.${col} = source.${col}`).join(', ')
const insertColumns = allColumns.join(', ')
const insertValues = allColumns.map((col) => `source.${col}`).join(', ')
@@ -68,12 +62,10 @@ export class SqlServerDialect implements SqlDialect {
}
}
paginate(params: {
paginate(params: { sql: string; limit: number; offset?: number; paramIndex: number }): {
sql: string
limit: number
offset?: number
paramIndex: number
}): { sql: string; nextParamIndex: number } {
nextParamIndex: number
} {
const { sql, limit, offset, paramIndex } = params
if (offset !== undefined) {