Skip to content

Commit

Permalink
restructure the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Oct 13, 2024
1 parent bb1509b commit 0874660
Show file tree
Hide file tree
Showing 13 changed files with 507 additions and 636 deletions.
6 changes: 0 additions & 6 deletions src/connections/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ import { Query, constructRawQuery } from '../query';
import { Connection } from './index';
import { Database, Table, TableColumn } from '../models/database';
import { BigQueryDialect } from '../query-builder/dialects/bigquery';

import { BigQuery } from '@google-cloud/bigquery';

type BigQueryParameters = {
keyFileName: string;
region: string;
};

export class BigQueryConnection implements Connection {
bigQuery: BigQuery;

Expand Down
277 changes: 0 additions & 277 deletions src/connections/cloudflare.ts

This file was deleted.

14 changes: 7 additions & 7 deletions src/connections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export interface QueryResult<T = Record<string, unknown>> {
query: string;
}

export interface Connection {
dialect: AbstractDialect;
export abstract class Connection {
abstract dialect: AbstractDialect;

// Handles logic for securely connecting and properly disposing of the connection.
connect: () => Promise<any>;
disconnect: () => Promise<any>;
abstract connect(): Promise<any>;
abstract disconnect(): Promise<any>;

// Raw query execution method that can be used to execute any query.
query: <T = Record<string, unknown>>(
abstract query<T = Record<string, unknown>>(
query: Query
) => Promise<QueryResult<T>>;
): Promise<QueryResult<T>>;

// Retrieve metadata about the database, useful for introspection.
fetchDatabaseSchema?: () => Promise<Database>;
abstract fetchDatabaseSchema(): Promise<Database>;
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0874660

Please sign in to comment.