drizzle-orm-sqlite
Advanced tools
Comparing version 0.12.0-beta.5 to 0.12.0-beta.6
@@ -5,3 +5,3 @@ import { Database, RunResult } from 'better-sqlite3'; | ||
import { SQLiteDialect } from '../dialect'; | ||
import { SQLiteSession } from '../session'; | ||
import { SQLiteSession, SQLiteStatement } from '../session'; | ||
export interface SQLiteDefaultSessionOptions { | ||
@@ -18,2 +18,3 @@ logger?: Logger; | ||
allObjects<T = unknown>(query: SQL): T[]; | ||
prepare<T>(query: SQL): SQLiteStatement<T>; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const drizzle_orm_1 = require("drizzle-orm"); | ||
const session_1 = require("../session"); | ||
class SQLiteDefaultSession { | ||
@@ -32,4 +33,9 @@ constructor(client, dialect, options = {}) { | ||
} | ||
prepare(query) { | ||
const preparedQuery = this.dialect.prepareSQL(query); | ||
this.logger.logQuery(preparedQuery.sql, preparedQuery.params); | ||
return new session_1.SQLiteStatement(this.client.prepare(preparedQuery.sql).bind(preparedQuery.params)); | ||
} | ||
} | ||
exports.SQLiteDefaultSession = SQLiteDefaultSession; | ||
//# sourceMappingURL=session.js.map |
@@ -6,3 +6,3 @@ /// <reference types="bun-types" /> | ||
import { SQLiteDialect } from '../dialect'; | ||
import { RunResult, SQLiteSession } from '../session'; | ||
import { RunResult, SQLiteSession, SQLiteStatement } from '../session'; | ||
export interface SQLiteBunSessionOptions { | ||
@@ -19,2 +19,3 @@ logger?: Logger; | ||
allObjects<T = unknown>(query: SQL): T[]; | ||
prepare<T>(query: SQL): SQLiteStatement<T>; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const drizzle_orm_1 = require("drizzle-orm"); | ||
const session_1 = require("../session"); | ||
class SQLiteBunSession { | ||
@@ -29,4 +30,9 @@ constructor(client, dialect, options = {}) { | ||
} | ||
prepare(query) { | ||
const preparedQuery = this.dialect.prepareSQL(query); | ||
this.logger.logQuery(preparedQuery.sql, preparedQuery.params); | ||
return new session_1.SQLiteStatement(this.client.prepare(preparedQuery.sql, ...preparedQuery.params)); | ||
} | ||
} | ||
exports.SQLiteBunSession = SQLiteBunSession; | ||
//# sourceMappingURL=session.js.map |
{ | ||
"name": "drizzle-orm-sqlite", | ||
"version": "0.12.0-beta.5", | ||
"version": "0.12.0-beta.6", | ||
"description": "Drizzle ORM package for SQLite database", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
import { PreparedQuery, SQL, SQLWrapper } from 'drizzle-orm/sql'; | ||
import { SQLiteDialect } from '../dialect'; | ||
import { SelectResultFields, SQLiteSelectFields, SQLiteSelectFieldsOrdered } from '../operations'; | ||
import { SQLiteSession } from '../session'; | ||
import { SQLiteSession, SQLiteStatement } from '../session'; | ||
import { AnySQLiteTable, GetTableConfig } from '../table'; | ||
@@ -37,3 +37,4 @@ import { AppendToResult, JoinNullability, JoinsValue, JoinType, SelectResult } from './select.types'; | ||
getQuery(): PreparedQuery; | ||
prepare(): SQLiteStatement<SelectResult<TTable, TResult, TInitialSelectResultFields, TJoinsNotNullable>>; | ||
execute(): SelectResult<TTable, TResult, TInitialSelectResultFields, TJoinsNotNullable>; | ||
} |
@@ -80,2 +80,5 @@ "use strict"; | ||
} | ||
prepare() { | ||
return this.session.prepare(this.getSQL()); | ||
} | ||
execute() { | ||
@@ -82,0 +85,0 @@ const query = this.dialect.buildSelectQuery(this.config); |
@@ -0,1 +1,4 @@ | ||
/// <reference types="bun-types" /> | ||
import type { Statement as BetterSqliteStatement } from 'better-sqlite3'; | ||
import type { Statement as BunStatement } from 'bun:sqlite'; | ||
import { SQL } from 'drizzle-orm/sql'; | ||
@@ -6,2 +9,7 @@ export interface RunResult { | ||
} | ||
export declare class SQLiteStatement<T> { | ||
private statement; | ||
constructor(statement: BunStatement | BetterSqliteStatement); | ||
execute(): T; | ||
} | ||
export interface SQLiteSession { | ||
@@ -11,2 +19,3 @@ run(query: SQL): RunResult; | ||
allObjects<T = unknown>(query: SQL): T[]; | ||
prepare<T>(query: SQL): SQLiteStatement<T>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SQLiteStatement = void 0; | ||
class SQLiteStatement { | ||
constructor(statement) { | ||
this.statement = statement; | ||
} | ||
execute() { | ||
return this.statement.all(); | ||
} | ||
} | ||
exports.SQLiteStatement = SQLiteStatement; | ||
//# sourceMappingURL=session.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171488
2730