Skip to content

Commit

Permalink
Remove @db/sqlite driver for now, see denodrivers/sqlite3#138
Browse files Browse the repository at this point in the history
  • Loading branch information
benmerckx committed Sep 11, 2024
1 parent 0823dd6 commit 7b330e8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 100 deletions.
3 changes: 1 addition & 2 deletions jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
".": "./src/index.ts",
"./sqlite": "./src/sqlite.ts",
"./mysql": "./src/mysql.ts",
"./postgres": "./src/postgres.ts",
"./driver": "./src/driver-jsr.ts"
"./postgres": "./src/postgres.ts"
}
}
1 change: 0 additions & 1 deletion src/core/Driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface BatchQuery {
}
export interface DriverSpecs {
parsesJson: boolean
parsesNestedJson?: boolean
}
export interface PrepareOptions {
isSelection: boolean
Expand Down
22 changes: 6 additions & 16 deletions src/core/expr/Include.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import type { DriverSpecs } from '../Driver.ts'
import type {DriverSpecs} from '../Driver.ts'
import {
type HasData,
type HasSql,
getData,
internalData,
internalSql
} from '../Internal.ts'
import type { QueryMeta } from '../MetaData.ts'
import type { MapRowContext, RowOfRecord } from '../Selection.ts'
import { type Sql, sql } from '../Sql.ts'
import type { Select, SelectBase, SelectData } from '../query/Select.ts'
import type {QueryMeta} from '../MetaData.ts'
import type {MapRowContext, RowOfRecord} from '../Selection.ts'
import {type Sql, sql} from '../Sql.ts'
import type {Select, SelectBase, SelectData} from '../query/Select.ts'

export interface IncludeData<Meta extends QueryMeta = QueryMeta>
extends SelectData<Meta> {
first: boolean
}

let isNested = false

export class Include<Result, Meta extends QueryMeta = QueryMeta>
implements HasData<IncludeData<Meta>>, HasSql<Result>
{
Expand All @@ -30,17 +28,11 @@ export class Include<Result, Meta extends QueryMeta = QueryMeta>

#mapFromDriverValue = (value: any, specs: DriverSpecs): any => {
const {select, first} = getData(this)
const {parsesJson, parsesNestedJson = parsesJson} = specs
const isPreParsed = isNested
? parsesNestedJson
: parsesJson
const parsed = isPreParsed ? value : JSON.parse(value)
const parsed = specs.parsesJson ? value : JSON.parse(value)
if (first) {
isNested = true
const result = parsed
? select!.mapRow({values: parsed, index: 0, specs})
: null
isNested = false
return result
}
if (!parsed) return []
Expand All @@ -50,13 +42,11 @@ export class Include<Result, Meta extends QueryMeta = QueryMeta>
index: 0,
specs
}
isNested = true
for (let i = 0; i < rows.length; i++) {
ctx.values = rows[i]
ctx.index = 0
rows[i] = select!.mapRow(ctx) as Array<unknown>
}
isNested = false
return rows ?? []
}

Expand Down
1 change: 0 additions & 1 deletion src/driver-jsr.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/driver.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './driver-jsr.ts'
export {connect as 'better-sqlite3'} from './driver/better-sqlite3.ts'
export {connect as 'bun:sqlite'} from './driver/bun-sqlite.ts'
export {connect as 'mysql2'} from './driver/mysql2.ts'
Expand Down
79 changes: 0 additions & 79 deletions src/driver/denodrivers-sqlite.ts

This file was deleted.

0 comments on commit 7b330e8

Please sign in to comment.