Skip to content

Commit 97ab48e

Browse files
juanluispazlorefnon
authored andcommitted
Add support to the new ts-sql-query custom types: customInt, customDouble, customUuid, customLocalDate, customLocalTime, customLocalDateTime
1 parent fe89623 commit 97ab48e

14 files changed

+727
-1
lines changed

src/field-mappings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const GeneratedFieldTypeSchema = z.object({
5757
/**
5858
* Specify that this field uses a custom database type or an enum type
5959
*/
60-
kind: z.enum(["custom", "customComparable", "enum"]).nullish(),
60+
kind: z.enum(["custom", "customComparable", "enum", "customInt", "customDouble", "customUuid", "customLocalDate", "customLocalTime", "customLocalDateTime"]).nullish(),
6161
/**
6262
* This name is a database type identifier as expected by ts-sql-query
6363
*
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre, 'genre'>('genre', 'customUuid', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre>('genre', 'customUuid', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre, 'genre'>('genre', 'customDouble', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre>('genre', 'customDouble', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre, 'genre'>('genre', 'customInt', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre>('genre', 'customInt', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre, 'genre'>('genre', 'customLocalDate', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre>('genre', 'customLocalDate', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// AuthorBooksTable.ts :
2+
/**
3+
* DO NOT EDIT:
4+
*
5+
* This file has been auto-generated from database schema using ts-sql-codegen.
6+
* Any changes will be overwritten.
7+
*/
8+
import { View } from "ts-sql-query/View";
9+
import type { DBConnection } from "../helpers/connection-source";
10+
import Genre from "./enums/Genre";
11+
12+
class AuthorBooksTable extends View<DBConnection, 'AuthorBooksTable'> {
13+
id = this.optionalColumn('id', 'uuid');
14+
name = this.optionalColumn('name', 'string');
15+
authorId = this.optionalColumn('author_id', 'int');
16+
releasedAt = this.optionalColumn('released_at', 'localDate');
17+
timeToRead = this.optionalColumn('time_to_read', 'int');
18+
genre = this.optionalColumn<Genre, 'genre'>('genre', 'customLocalDateTime', 'genre');
19+
weightGrams = this.optionalColumn('weight_grams', 'double');
20+
authorName = this.optionalColumn('author_name', 'string');
21+
22+
constructor() {
23+
super('author_books');
24+
}
25+
}
26+
27+
export const tAuthorBooks = new AuthorBooksTable();
28+

0 commit comments

Comments
 (0)