The following query generates to the following types:
import { sql } from "sqlx-ts";
export const bannerQuery = sql`
SELECT background_color, text_color, link, message, end FROM announcements WHERE publish = 1 AND ? >= begin AND end >= ?`;
export type BannerQueryParams = [boolean, Date];
export interface IBannerQueryResult {
background_color: string;
end: Date;
link: string | null;
message: string | null;
text_color: string;
}
export interface IBannerQueryQuery {
params: BannerQueryParams;
result: IBannerQueryResult;
}
The expected codegen should be:
export type BannerQueryParams = [Date, Date];
export interface IBannerQueryResult {
background_color: string;
end: Date;
link: string | null;
message: string | null;
text_color: string;
}
export interface IBannerQueryQuery {
params: BannerQueryParams;
result: IBannerQueryResult;
}
Likely semi-related to the same issue, but another example is the following query:
import { sql } from "sqlx-ts";
export const bannerQuery = sql`
SELECT background_color, text_color, link, message, end FROM announcements WHERE publish = 1 AND ? BETWEEN begin AND end`;
This query generates to:
export type BannerQueryParams = [];
export interface IBannerQueryResult {
background_color: string;
end: Date;
link: string | null;
message: string | null;
text_color: string;
}
export interface IBannerQueryQuery {
params: BannerQueryParams;
result: IBannerQueryResult;
}
When it should generate to:
```ts
export type BannerQueryParams = [Date];
export interface IBannerQueryResult {
background_color: string;
end: Date;
link: string | null;
message: string | null;
text_color: string;
}
export interface IBannerQueryQuery {
params: BannerQueryParams;
result: IBannerQueryResult;
}
but this can be a lack of support for the BETWEEN clause.
The following query generates to the following types:
The expected codegen should be:
Likely semi-related to the same issue, but another example is the following query:
This query generates to:
When it should generate to:
but this can be a lack of support for the
BETWEENclause.