diff --git a/mysql/index.d.ts b/mysql/index.d.ts new file mode 100644 index 0000000..cbfd75d --- /dev/null +++ b/mysql/index.d.ts @@ -0,0 +1,19 @@ +declare module 'sqlutils/mysql' { + type Transformation = { + key: string | [string, string], + columns?: Array, + children?: Array + } + + type ChildTransformation = { + rename: string, + single?: boolean, + flat?: boolean + } + + export function format(statement: string, obj: object|object[]): string + export function escape(value: any): string + export function buildWhereFromQuery(query: object): string + export function groupColumnsToObjects(rows: object[], primary_key: string, groups: object[]): object[] + export function transformer(rows: any[], transformation: Transformation): object[] +}; \ No newline at end of file diff --git a/pg/index.d.ts b/pg/index.d.ts new file mode 100644 index 0000000..d47edb3 --- /dev/null +++ b/pg/index.d.ts @@ -0,0 +1,19 @@ +declare module 'sqlutils/pg' { + type Transformation = { + key: string | [string, string], + columns?: Array, + children?: Array + } + + type ChildTransformation = { + rename: string, + single?: boolean, + flat?: boolean + } + + export function format(statement: string, obj: object|object[]): string + export function escape(value: any): string + export function buildWhereFromQuery(query: object): string + export function groupColumnsToObjects(rows: object[], primary_key: string, groups: object[]): object[] + export function transformer(rows: any[], transformation: Transformation): object[] +}; \ No newline at end of file