Skip to content

Commit

Permalink
Added new id
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Jul 19, 2024
1 parent 372adf0 commit 4b92d7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/compiler/postgres/PostgreSqlMethodTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export const PostgreSqlHelper: ISqlHelpers = {
return prepareAny `(${a} ::boolean)`;
}
},
crypto: {
randomUUID() {
return [`gen_random_uuid()`];
},
},
date: {
now() {
return prepareAny `NOW()`;
Expand Down
5 changes: 5 additions & 0 deletions src/compiler/sql-server/SqlServerSqlMethodTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export const SqlServerSqlHelper: ISqlHelpers = {
return prepareAny `CAST(${a} as bit)`;
}
},
crypto: {
randomUUID() {
return [`NEWID()`];
},
},
date: {
now() {
return prepareAny `GETUTCDATE()`;
Expand Down
6 changes: 5 additions & 1 deletion src/sql/ISql.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import DateTime from "../types/DateTime.js";

class GUID {}

export interface ISql {

in<T>(a: T, array: T[]): boolean;
Expand All @@ -19,11 +21,13 @@ export interface ISql {
asDecimal(a: any): number;
asBoolean(a: any): boolean;
},
crypto: {
randomUUID(): GUID
},
math: {
min<T>(... a: T[]): T,
max<T>(... a: T[]): T,
},

text: {
concat(... fragments: string[]): string;
concatImmutable(... fragments: string[]): string;
Expand Down

0 comments on commit 4b92d7b

Please sign in to comment.