(name: string)
| 401 | } |
| 402 | |
| 403 | function getOpName(name: string): string { |
| 404 | const opNames = { |
| 405 | eq: `=`, |
| 406 | gt: `>`, |
| 407 | gte: `>=`, |
| 408 | lt: `<`, |
| 409 | lte: `<=`, |
| 410 | add: `+`, |
| 411 | and: `AND`, |
| 412 | or: `OR`, |
| 413 | not: `NOT`, |
| 414 | isUndefined: `IS NULL`, |
| 415 | isNull: `IS NULL`, |
| 416 | in: `= ANY`, // Use = ANY syntax for array parameters |
| 417 | like: `LIKE`, |
| 418 | ilike: `ILIKE`, |
| 419 | upper: `UPPER`, |
| 420 | lower: `LOWER`, |
| 421 | length: `LENGTH`, |
| 422 | concat: `CONCAT`, |
| 423 | coalesce: `COALESCE`, |
| 424 | } |
| 425 | |
| 426 | const opName = opNames[name as keyof typeof opNames] |
| 427 | |
| 428 | if (!opName) { |
| 429 | throw new Error(`Unknown operator/function: ${name}`) |
| 430 | } |
| 431 | |
| 432 | return opName |
| 433 | } |