Skip to content

Commit

Permalink
Add data types hints for intellisense
Browse files Browse the repository at this point in the history
  • Loading branch information
eveningkid committed May 21, 2020
1 parent 714a04d commit 5d4b631
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/data-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Fields } from "./query-builder.ts";

export type FieldTypes =
| "INTEGER"
| "FLOAT"
| "BOOLEAN"
| "STRING"
| "TEXT"
| "DATETIME";

/** Available fields data types. */
export const DATA_TYPES: Fields = {
INTEGER: "integer",
Expand Down
5 changes: 4 additions & 1 deletion lib/query-builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SQLQueryBuilder } from "../deps.ts";
import { DatabaseDialect } from "./database.ts";
import { FieldTypes } from "./data-types.ts";

export type FieldValue = number | string | boolean | Date;
export type FieldTypeString =
Expand All @@ -9,7 +10,9 @@ export type FieldTypeString =
| "text"
| "date"
| "float";
export type Fields = { [key: string]: FieldTypeString };
export type Fields = {
[key in FieldTypes]: FieldTypeString;
};
export type Values = { [key: string]: FieldValue };
export type FieldType = FieldTypeString | {
type?: FieldTypeString;
Expand Down

0 comments on commit 5d4b631

Please sign in to comment.