Release: weekly deploy
This commit is contained in:
@@ -32,6 +32,11 @@ function sqlLiteral(value) {
|
||||
if (typeof value === 'boolean') return value ? 'TRUE' : 'FALSE';
|
||||
if (value instanceof Date) return `'${value.toISOString()}'`;
|
||||
if (typeof value === 'number' || typeof value === 'bigint') return String(value);
|
||||
// node-pg returns JS arrays for Postgres array columns (e.g. users.permissions TEXT[])
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 0) return `ARRAY[]::text[]`;
|
||||
return `ARRAY[${value.map((item) => sqlLiteral(item)).join(', ')}]`;
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user