@bunit/qb 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialects/{dialects/mysql.d.ts → mysql.d.ts} +1 -2
- package/dist/dialects/mysql.mjs +1 -3
- package/dist/dialects/{dialects/postgres.d.ts → postgres.d.ts} +1 -2
- package/dist/dialects/postgres.mjs +1 -3
- package/dist/dialects/{dialects/sqlite.d.ts → sqlite.d.ts} +1 -2
- package/dist/dialects/sqlite.mjs +1 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/sql.mjs +3 -0
- package/dist/{dialects/types.d.ts → types.d.ts} +3 -3
- package/package.json +1 -1
- package/dist/dialects/sql.d.ts +0 -13
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
2
|
-
import type { Kysely } from "kysely";
|
|
1
|
+
import type { Kysely, DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
3
2
|
import type { BunSQLDialectConfig } from "../types";
|
|
4
3
|
export interface MySQLDialectConfig extends BunSQLDialectConfig {
|
|
5
4
|
}
|
package/dist/dialects/mysql.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { MysqlAdapter } from "kysely";
|
|
2
|
-
import { MysqlIntrospector } from "kysely";
|
|
3
|
-
import { MysqlQueryCompiler } from "kysely";
|
|
1
|
+
import { MysqlAdapter, MysqlIntrospector, MysqlQueryCompiler } from "kysely";
|
|
4
2
|
import { BunSQLDriver } from "../sql";
|
|
5
3
|
|
|
6
4
|
export class MySQLDialect {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
2
|
-
import type { Kysely } from "kysely";
|
|
1
|
+
import type { Kysely, DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
3
2
|
import type { BunSQLDialectConfig } from "../types";
|
|
4
3
|
export interface PostgresDialectConfig extends BunSQLDialectConfig {
|
|
5
4
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { PostgresAdapter } from "kysely";
|
|
2
|
-
import { PostgresIntrospector } from "kysely";
|
|
3
|
-
import { PostgresQueryCompiler } from "kysely";
|
|
1
|
+
import { PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from "kysely";
|
|
4
2
|
import { BunSQLDriver } from "../sql";
|
|
5
3
|
|
|
6
4
|
export class PostgresDialect {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
2
|
-
import type { Kysely } from "kysely";
|
|
1
|
+
import type { Kysely, DatabaseIntrospector, Dialect, DialectAdapter, Driver, QueryCompiler } from "kysely";
|
|
3
2
|
import type { BunSQLDialectConfig } from "../types";
|
|
4
3
|
export interface SQLiteDialectConfig extends BunSQLDialectConfig {
|
|
5
4
|
}
|
package/dist/dialects/sqlite.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { SqliteAdapter } from "kysely";
|
|
2
|
-
import { SqliteIntrospector } from "kysely";
|
|
3
|
-
import { SqliteQueryCompiler } from "kysely";
|
|
1
|
+
import { SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler } from "kysely";
|
|
4
2
|
import { BunSQLDriver } from "../sql";
|
|
5
3
|
|
|
6
4
|
export class SQLiteDialect {
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
2
|
+
import{a as n}from"./sql.mjs";export*from"kysely";export{n as BunSQLDriver};
|
package/dist/sql.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{CompiledQuery as z}from"kysely";var{SQL:A}=globalThis.Bun;class E{#j;#h;constructor(h){this.#j=h}async init(){let{url:h,options:j}=this.#j;if(h)this.#h=new A(h,j??{});else if(j)this.#h=new A(j);else throw Error("Either url or options must be provided");await this.#h.connect()}async acquireConnection(){if(!this.#h)throw Error("Driver not initialized. Call init() first.");return new D(this.#h)}async beginTransaction(h,j){if(j.isolationLevel||j.accessMode){let v="start transaction";if(j.isolationLevel)v+=` isolation level ${j.isolationLevel}`;if(j.accessMode)v+=` ${j.accessMode}`;await h.executeQuery(z.raw(v))}else await h.executeQuery(z.raw("begin"))}async commitTransaction(h){await h.executeQuery(z.raw("commit"))}async rollbackTransaction(h){await h.executeQuery(z.raw("rollback"))}async releaseConnection(h){}async destroy(){if(this.#h)await this.#h.end(),this.#h=void 0}}class D{#j;constructor(h){this.#j=h}async executeQuery(h){let{sql:j,parameters:v}=h,x=await this.#j.unsafe(j,[...v]);return{rows:Array.isArray(x)?x:x?[x]:[]}}streamQuery(h,j){throw Error("Streaming queries are not supported")}}export{E as BunSQLDriver};
|
|
3
|
+
export{E as a};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { SQL } from "bun";
|
|
2
2
|
export interface BunSQLDialectConfig {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
url?: string | URL;
|
|
4
|
+
options?: ConstructorParameters<typeof SQL>[0];
|
|
5
5
|
}
|
|
6
6
|
/** @internal */
|
|
7
7
|
export interface BunSQLDriverConfig extends BunSQLDialectConfig {
|
|
8
|
-
|
|
8
|
+
adapter: "postgres" | "mysql" | "sqlite";
|
|
9
9
|
}
|
package/package.json
CHANGED
package/dist/dialects/sql.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DatabaseConnection, Driver, TransactionSettings } from "kysely";
|
|
2
|
-
import type { BunSQLDriverConfig } from "./types";
|
|
3
|
-
export declare class BunSQLDriver implements Driver {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(config: BunSQLDriverConfig);
|
|
6
|
-
init(): Promise<void>;
|
|
7
|
-
acquireConnection(): Promise<DatabaseConnection>;
|
|
8
|
-
beginTransaction(connection: DatabaseConnection, settings: TransactionSettings): Promise<void>;
|
|
9
|
-
commitTransaction(connection: DatabaseConnection): Promise<void>;
|
|
10
|
-
rollbackTransaction(connection: DatabaseConnection): Promise<void>;
|
|
11
|
-
releaseConnection(_connection: DatabaseConnection): Promise<void>;
|
|
12
|
-
destroy(): Promise<void>;
|
|
13
|
-
}
|