-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from treegex/dev
added typeScript definitions
- Loading branch information
Showing
8 changed files
with
286 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as dataType from './type/DataType'; | ||
import * as fieldHelper from './type/FieldHelper'; | ||
import * as queryHelper from './type/QueryHelper'; | ||
import * as keywordHelper from './type/KeywordHelper'; | ||
import * as variableDataType from './type/VariableDataType'; | ||
|
||
|
||
declare module 'opensql' { | ||
|
||
let fieldHelper: fieldHelper.FieldHelper; | ||
|
||
let dataType: dataType.DataType; | ||
|
||
let keywordHelper: keywordHelper.KeywordHelper; | ||
|
||
let variableDataType: variableDataType.VariableDataType; | ||
|
||
let queryHelper: queryHelper.QueryHelper; | ||
|
||
export function connect(jsonObject: object): any; | ||
|
||
export function createDatabase(name?: string): any; | ||
|
||
export function createTable(jsonObject: object): any; | ||
|
||
export function dropTable(data: string[] | string): any; | ||
|
||
export function addForeignKey(jsonObject: object): any; | ||
|
||
export function remove(jsonObject: object): any; | ||
|
||
export function update(jsonObject: object): any; | ||
|
||
export function addMultiValue(jsonObject: object): any; | ||
|
||
export function addOne(jsonObject: object): any; | ||
|
||
export function addWithFind(jsonObject: object): any; | ||
|
||
export function customQuery(sqlQuery: string, inject?: object | any[]): any; | ||
|
||
export function dropDatabase(databaseName?: string): any; | ||
|
||
export function find(jsonObject: object): any; | ||
|
||
export function findTable(tableName: string, databaseName?: string): any; | ||
|
||
export function result(fn: Function): any; | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,73 @@ | ||
declare module dataType { | ||
|
||
interface DataType { | ||
|
||
VARCHAR(data: number | any[]): string; | ||
|
||
INT(data?: number | any[]): string; | ||
|
||
CHAR(data: number | any[]): string; | ||
|
||
DATE(data?: any[]): string; | ||
|
||
TIME(data?: any[]): string; | ||
|
||
DATETIME(data?: any[]): string; | ||
|
||
ENUM(data: any[]): string; | ||
|
||
BOOLEAN(data?: number | any[]): string; | ||
|
||
POINT(data?: number | any[]): string; | ||
|
||
TINYINT(data?: number | any[]): string; | ||
|
||
SMALLINT(data?: number | any[]): string; | ||
|
||
MEDIUMINT(data?: number | any[]): string; | ||
|
||
BIGINT(data?: number | any[]): string; | ||
|
||
DECIMAL(data?: number | any[]): string; | ||
|
||
FLOAT(data?: number | any[]): string; | ||
|
||
DOUBLE(data?: number | any[]): string; | ||
|
||
REAL(data?: number | any[]): string; | ||
|
||
BIT(data?: number | any[]): string; | ||
|
||
SERIAL(data?: number | any[]): string; | ||
|
||
TIMESTAMP(data?: any[]): string; | ||
|
||
YEAR(data?: any[]): string; | ||
|
||
TINYTEXT(data?: number | any[]): string; | ||
|
||
TEXT(data?: number | any[]): string; | ||
|
||
MEDIUMTEXT(data?: number | any[]): string; | ||
|
||
LONGTEXT(data?: number | any[]): string; | ||
|
||
BINARY(data?: number | any[]): string; | ||
|
||
VARBINARY(data: number | any[]): string; | ||
|
||
TINYBLOB(data?: any[]): string; | ||
|
||
BLOB(data?: any[]): string; | ||
|
||
MEDIUMBLOB(data?: any[]): string; | ||
|
||
LONGBLOB(data?: any[]): string; | ||
|
||
SET(data: any[]): string; | ||
|
||
} | ||
|
||
} | ||
|
||
export = dataType; |
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,15 @@ | ||
declare module fieldHelper { | ||
|
||
interface FieldHelper { | ||
|
||
POINT(Lat: number, Lon: number): string; | ||
|
||
fieldPoint(field: string): string; | ||
|
||
DEFAULT(value: string): string; | ||
|
||
} | ||
|
||
} | ||
|
||
export = fieldHelper; |
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,38 @@ | ||
declare module keywordHelper { | ||
|
||
interface KeywordHelper { | ||
|
||
OR: string; | ||
IN: string; | ||
AND: string; | ||
ASC: string; | ||
STAR: string; | ||
DESC: string; | ||
LIKE: string; | ||
CAST: string; | ||
COMMA: string; | ||
UNION: string; | ||
LIMIT: string; | ||
COUNT: string; | ||
NOT_IN: string; | ||
OFFSET: string; | ||
BETWEEN: string; | ||
CASCADE: string; | ||
DISTINCT: string; | ||
SET_NULL: string; | ||
GROUP_BY: string; | ||
RESTRICT: string; | ||
ORDER_BY: string; | ||
UNION_ALL: string; | ||
NO_ACTION: string; | ||
NOT_BETWEEN: string; | ||
IF_NOT_EXISTS: string; | ||
QUESTION_MARK: string; | ||
AUTO_INCREMENT: string; | ||
DOUBLE_QUESTION_MARK: string; | ||
|
||
} | ||
|
||
} | ||
|
||
export = keywordHelper; |
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,64 @@ | ||
declare module queryHelper { | ||
|
||
interface QueryHelper { | ||
|
||
NULL: string; | ||
IS_NULL: string; | ||
NOT_NULL: string; | ||
EQUAL_TO: string; | ||
LESS_THAN: string; | ||
IS_NOT_NULL: string; | ||
GREATER_THAN: string; | ||
NOT_EQUAL_TO: string; | ||
LESS_THAN_OR_EQUAL_TO: string; | ||
GREATER_THAN_OR_EQUAL_TO: string; | ||
|
||
setOperator(operator: string, value: string, op?: string): string; | ||
|
||
OR(jsonObject: object, operator?: any): string[]; | ||
|
||
AND(jsonObject: object, operator?: any): string[]; | ||
|
||
IN(arr: any[], op?: string): string; | ||
|
||
NOT_IN(arr: any[], op?: string): string; | ||
|
||
BETWEEN(first: number, second: number, op?: string): string; | ||
|
||
NOT_BETWEEN(first: number, second: number, op?: string): string; | ||
|
||
LIKE(str: string, op?: string): string; | ||
|
||
CAST(data: string | number, type: string): string; | ||
|
||
COUNT(column?: string | string[]): string; | ||
|
||
AS(first: string, second: String): string; | ||
|
||
SOURCE(name: string, typeName?: string): string; | ||
|
||
ATTACH(array: string[], op?: string): object; | ||
|
||
UNION(jsonObject: object): object; | ||
|
||
NOT(str: string, op?: string): string; | ||
|
||
UNION_ALL(jsonObject: object): object; | ||
|
||
MIN(column: string): string; | ||
|
||
MAX(column: string): string; | ||
|
||
SUM(column: string): string; | ||
|
||
AVG(column: string): string; | ||
|
||
CONCAT_WS(str: string, array: string[], column: string): string; | ||
|
||
GROUP(data: string | string[]): string; | ||
|
||
} | ||
|
||
} | ||
|
||
export = queryHelper; |
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,42 @@ | ||
declare module variableDataType { | ||
|
||
interface VariableDataType { | ||
|
||
int: string; | ||
bit: string; | ||
text: string; | ||
Enum: string; | ||
set: string; | ||
real: string; | ||
year: string; | ||
blob: string; | ||
char: string; | ||
date: string; | ||
time: string; | ||
point: string; | ||
float: string; | ||
bigint: string; | ||
binary: string; | ||
serial: string; | ||
double: string; | ||
decimal: string; | ||
boolean: string; | ||
varchar: string; | ||
tinyint: string; | ||
tinyblob: string; | ||
longblob: string; | ||
longtext: string; | ||
tinytext: string; | ||
smallint: string; | ||
datetime: string; | ||
timestamp: string; | ||
mediumint: string; | ||
varbinary: string; | ||
mediumblob: string; | ||
mediumtext: string; | ||
|
||
} | ||
|
||
} | ||
|
||
export = variableDataType; |