Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions examples/node-better-sqlite3/src/db/query_sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ SELECT id, name, bio FROM authors
WHERE id = ? LIMIT 1`;

export interface GetAuthorArgs {
id: any;
id: number;
}

export interface GetAuthorRow {
id: any;
name: any;
bio: any | null;
id: number;
name: string;
bio: string | null;
}

export async function getAuthor(database: Database, args: GetAuthorArgs): Promise<GetAuthorRow | null> {
Expand All @@ -30,9 +30,9 @@ SELECT id, name, bio FROM authors
ORDER BY name`;

export interface ListAuthorsRow {
id: any;
name: any;
bio: any | null;
id: number;
name: string;
bio: string | null;
}

export async function listAuthors(database: Database): Promise<ListAuthorsRow[]> {
Expand All @@ -49,8 +49,8 @@ INSERT INTO authors (
)`;

export interface CreateAuthorArgs {
name: any;
bio: any | null;
name: string;
bio: string | null;
}

export async function createAuthor(database: Database, args: CreateAuthorArgs): Promise<void> {
Expand All @@ -63,7 +63,7 @@ DELETE FROM authors
WHERE id = ?`;

export interface DeleteAuthorArgs {
id: any;
id: number;
}

export async function deleteAuthor(database: Database, args: DeleteAuthorArgs): Promise<void> {
Expand Down
7 changes: 6 additions & 1 deletion src/drivers/better-sqlite3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Driver {
}

let typ: TypeNode = factory.createKeywordTypeNode(SyntaxKind.AnyKeyword);
switch (column.type.name) {
switch (column.type.name.toLowerCase()) {
case "int":
case "integer":
case "tinyint":
Expand Down Expand Up @@ -89,6 +89,11 @@ export class Driver {
typ = factory.createKeywordTypeNode(SyntaxKind.BooleanKeyword);
break;
}
case "text":
case "varchar": {
typ = factory.createKeywordTypeNode(SyntaxKind.StringKeyword);
break;
}
case "date":
case "datetime":
case "timestamp": {
Expand Down