-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Slonik has a concept of SQL fragments (https://github.com/gajus/slonik?tab=readme-ov-file#sqlfragment)
There are effectively fragments of query that would not have a type, e.g.
const whereFragment = sql.fragment`
WHERE bar = 'baz';
`;
sql.typeAlias('id')`
SELECT id
FROM foo
${whereFragment}
`
Supporting this requires the ability to exclude fragment from type matching (or even the whole query).
safeql.configs.connections({
overrides: {
types: {
array: 'ListSqlToken',
date: 'DateSqlToken',
json: 'JsonSqlToken',
jsonb: 'JsonBinarySqlToken',
timestamp: 'TimestampSqlToken',
+ // obvious not, but this appears to be not used anywhere, and I still need to provide a valid type
+ timestamptz: 'SqlFragmentToken',
uuid: '`${string}-${string}-${string}-${string}-${string}`',
},
},I've tried working around this by assigning a random type, but this causes queries to fail, e.g.
Invalid Query: column "location" is of type geometry but expression is of type timestamp with time zone
Note that there might be multiple that need an escape hatch.
Metadata
Metadata
Assignees
Labels
No labels