-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change KnexProvider interface, add helper functions for testing knex
- Loading branch information
Showing
19 changed files
with
229 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/// <reference path="../../contracts/KnexProvider.d.ts" /> | ||
import '../../providers/KnexProvider'; | ||
import { IFacade, IFacadeBase } from 'najs-facade'; | ||
import { QueryBuilder, Config } from 'knex'; | ||
export interface IKnexProviderFacade extends Najs.Contracts.Eloquent.KnexProvider<QueryBuilder, Config> { | ||
import * as Knex from 'knex'; | ||
export interface IKnexProviderFacade extends Najs.Contracts.Eloquent.KnexProvider<Knex, Knex.QueryBuilder, Knex.Config> { | ||
} | ||
export declare const KnexProviderFacade: IKnexProviderFacade & IFacade; | ||
export declare const KnexProvider: IKnexProviderFacade & IFacadeBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
/// <reference path="../contracts/KnexProvider.d.ts" /> | ||
import * as Knex from 'knex'; | ||
import { Facade } from 'najs-facade'; | ||
import { QueryBuilder, Config } from 'knex'; | ||
export declare class KnexProvider extends Facade implements Najs.Contracts.Eloquent.KnexProvider<QueryBuilder, Config> { | ||
export declare class KnexProvider extends Facade implements Najs.Contracts.Eloquent.KnexProvider<Knex, QueryBuilder, Config> { | ||
protected config: Config; | ||
getClassName(): string; | ||
setDefaultConfig(config: Config): this; | ||
getDefaultConfig(): Config; | ||
create(table: string, config?: Config): QueryBuilder; | ||
createKnex(config?: Config): Knex; | ||
createQueryBuilder(table: string, config?: Config): QueryBuilder; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'jest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("jest"); | ||
const util_1 = require("../util"); | ||
// import { KnexProvider } from '../../lib/facades/global/KnexProviderFacade' | ||
describe('KnexQueryBuilder', function () { | ||
beforeAll(async function () { | ||
return util_1.init_knex('najs_eloquent_knex_query_builder').then(function () { | ||
return util_1.knex_run_sql(`CREATE TABLE users ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
first_name VARCHAR(255), | ||
last_name VARCHAR(255), | ||
email VARCHAR(255), | ||
created_at DATETIME, | ||
updated_at DATETIME, | ||
deleted_at DATETIME, | ||
age INT, | ||
PRIMARY KEY (id) | ||
)`); | ||
}); | ||
}); | ||
it('should work', function () { }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.