export all interfaces by wrapping them in exported Knex namespace

This commit is contained in:
yortus
2015-08-10 18:44:38 +08:00
parent 3ece183e16
commit ac75761608
+10 -12
View File
@@ -13,28 +13,29 @@ declare module "knex" {
type Callback = Function;
type Client = Function;
type Value = string|number|boolean|Date;
type ColumnName = string|Raw|QueryBuilder;
type ColumnName = string|Knex.Raw|Knex.QueryBuilder;
interface Knex extends QueryInterface { }
interface Knex {
(tableName?: string): QueryBuilder;
interface Knex extends Knex.QueryInterface {
(tableName?: string): Knex.QueryBuilder;
VERSION: string;
__knex__: string;
raw: RawBuilder;
transaction: <R>(transactionScope: ((trx: Transaction) => void)) => Promise<any>;
raw: Knex.RawBuilder;
transaction: <R>(transactionScope: ((trx: Knex.Transaction) => void)) => Promise<any>;
destroy(callback: Function): void;
destroy(): Promise<void>;
schema: Knex.SchemaBuilder;
client: any;
migrate: any;
seed: any;
fn: any;
}
function Knex( config : Config ) : Knex;
function Knex( config : Knex.Config ) : Knex;
namespace Knex {
//
// QueryInterface
//
@@ -296,10 +297,6 @@ declare module "knex" {
// Schema builder
//
interface Knex {
schema: SchemaBuilder;
}
interface SchemaBuilder {
createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): Promise<void>;
renameTable(oldTableName: string, newTableName: string): Promise<void>;
@@ -448,6 +445,7 @@ declare module "knex" {
extension?: string;
tableName?: string;
}
}
export = Knex;
}