Skip to content

Commit

Permalink
adding driver
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Feb 1, 2020
1 parent 56c96f4 commit d41e936
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/connection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {IQueryResult} from './result';
import {IConnectionParams} from './params';
import {PgDriver} from './driver';

export interface IPreparedStatement {
name: string
Expand All @@ -23,8 +24,12 @@ export interface IConnectionOptions {
}

export class Connection {
constructor(options: IConnectionOptions) {

private driver: PgDriver;

constructor(options?: IConnectionOptions) {
this.driver = new PgDriver();
this.driver.connect();
}

async connect(cn: IConnectionParams): Promise<void> {
Expand Down
12 changes: 12 additions & 0 deletions src/driver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Encapsulates all low-level communications,
* to keep the rest of the library code clean.
*
* This interface is internal to the library.
*/
export class PgDriver {

connect() {

}
}
8 changes: 3 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export class Test {
constructor() {

}
}
export {Connection, IConnectionOptions, IPreparedStatement} from './connection';
export {Pool, IPoolOptions} from './pool';
export {IQueryResult, IField} from './result';
8 changes: 8 additions & 0 deletions test/connection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {expect} from './';
import {Connection} from '../src';

describe('Connection', () => {
it('can be created', () => {
expect(new Connection()).to.be.instanceOf(Connection);
});
});
8 changes: 8 additions & 0 deletions test/driver.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {expect} from './';
import {PgDriver} from '../src/driver';

describe('Driver', () => {
it('can be created', () => {
expect(new PgDriver()).to.be.instanceOf(PgDriver);
});
});
8 changes: 0 additions & 8 deletions test/main.spec.ts

This file was deleted.

0 comments on commit d41e936

Please sign in to comment.