File tree Expand file tree Collapse file tree
apps/desktop/src/entities/connection
packages/shared/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,6 @@ export const dialects = {
2525 mssql : memoize ( ( connection : typeof connections . $inferSelect ) => new Kysely < MssqlDatabase > ( { dialect : mssqlDialect ( connection ) } ) ) ,
2626} satisfies Record < ConnectionType , ( connection : typeof connections . $inferSelect ) => unknown >
2727
28- export function getColdKysely ( dialect : ConnectionType ) {
28+ export function getColdDialect ( dialect : ConnectionType ) {
2929 return new Kysely < Record < string , Record < string , unknown > > > ( { dialect : coldDialects [ dialect ] ( ) } )
3030}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type { enumType } from '../../sql/enums'
44import type { Index } from '../utils'
55import { ConnectionType } from '@conar/shared/enums/connection-type'
66import { formatSql } from '~/lib/formatter'
7- import { getColdKysely } from '../../dialects'
7+ import { getColdDialect } from '../../dialects'
88import { findEnum } from '../../sql/enums'
99import { buildWhere } from '../../sql/rows'
1010import * as templates from '../templates'
@@ -20,7 +20,7 @@ export function generateQuerySQL({
2020 filters,
2121 dialect = ConnectionType . Postgres ,
2222} : QueryParams ) {
23- const db = getColdKysely ( dialect )
23+ const db = getColdDialect ( dialect )
2424 const base = db . withTables < { [ table ] : Record < string , unknown > } > ( ) . selectFrom ( table ) . selectAll ( )
2525 const query = filters . length > 0 ? base . where ( eb => buildWhere ( eb , filters ) ) : base
2626 const compiled = query . compile ( )
Original file line number Diff line number Diff line change @@ -76,10 +76,10 @@ export function tryParseJson<T>(json: string): T | null {
7676 }
7777}
7878
79- export function memoize < F extends ( ...args : Parameters < F > ) => ReturnType < F > > ( func : F ) {
79+ export function memoize < F extends ( ...args : Parameters < F > ) => ReturnType < F > > ( func : F ) : F {
8080 const cache = new Map < string , ReturnType < F > > ( )
8181
82- return ( ...args : Parameters < F > ) => {
82+ return ( ( ...args : Parameters < F > ) => {
8383 const key = JSON . stringify ( args )
8484 if ( cache . has ( key ) ) {
8585 return cache . get ( key ) !
@@ -94,5 +94,5 @@ export function memoize<F extends (...args: Parameters<F>) => ReturnType<F>>(fun
9494 }
9595
9696 return result
97- }
97+ } ) as F
9898}
You can’t perform that action at this time.
0 commit comments