-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
182 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
"@ts-safeql/eslint-plugin": patch | ||
"@ts-safeql/generate": patch | ||
"@ts-safeql/shared": patch | ||
--- | ||
|
||
you can now override the default types (e.g. timestamp -> DateTime) by adding an `overrides` property to the config: | ||
|
||
```ts | ||
// safeql.config.ts | ||
import { definedConfig } from "@ts-safeql/eslint-plugin"; | ||
|
||
export default definedConfig({ | ||
// ... | ||
overrides: { | ||
types: { | ||
timestamp: "DateTime", | ||
}, | ||
}, | ||
}); | ||
``` | ||
|
||
or | ||
|
||
```json | ||
// .eslintrc.json | ||
{ | ||
// ... | ||
"connections": { | ||
// ..., | ||
"overrides": { | ||
"types": { | ||
"timestamp": "DateTime" | ||
} | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./common"; | ||
export * from "./errors"; | ||
export * from "./parsedQuery"; | ||
export * from "./pg"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export const defaultTypeMapping = { | ||
// Integer types | ||
int2: "number", | ||
int4: "number", | ||
int8: "string", | ||
smallint: "number", | ||
int: "number", | ||
bigint: "string", | ||
|
||
// Precision types | ||
real: "number", | ||
float4: "number", | ||
float: "number", | ||
float8: "number", | ||
numeric: "number", | ||
decimal: "number", | ||
|
||
// Serial types | ||
smallserial: "number", | ||
serial: "number", | ||
bigserial: "string", | ||
|
||
// Common string types | ||
uuid: "string", | ||
text: "string", | ||
varchar: "string", | ||
char: "string", | ||
bpchar: "string", | ||
citext: "string", | ||
|
||
// Bool types | ||
bit: "boolean", | ||
bool: "boolean", | ||
boolean: "boolean", | ||
|
||
// Dates and times | ||
date: "Date", | ||
timestamp: "Date", | ||
timestamptz: "Date", | ||
time: "Date", | ||
timetz: "Date", | ||
interval: "string", | ||
|
||
// Network address types | ||
inet: "string", | ||
cidr: "string", | ||
macaddr: "string", | ||
macaddr8: "string", | ||
|
||
// Extra types | ||
money: "number", | ||
void: "void", | ||
|
||
// JSON types | ||
json: "any", | ||
jsonb: "any", | ||
|
||
// Bytes | ||
bytea: "any", | ||
} as const; |