(
value: unknown,
onCustom: (
type: Custom<string, unknown, unknown>,
placeholder: (u: unknown) => string,
withoutTransform: boolean
) => readonly [sql: string, binds: ReadonlyArray<unknown>],
placeholder: (u: unknown) => string,
withoutTransform: boolean
)
| 1474 | } |
| 1475 | |
| 1476 | const extractPrimitive = ( |
| 1477 | value: unknown, |
| 1478 | onCustom: ( |
| 1479 | type: Custom<string, unknown, unknown>, |
| 1480 | placeholder: (u: unknown) => string, |
| 1481 | withoutTransform: boolean |
| 1482 | ) => readonly [sql: string, binds: ReadonlyArray<unknown>], |
| 1483 | placeholder: (u: unknown) => string, |
| 1484 | withoutTransform: boolean |
| 1485 | ): unknown => { |
| 1486 | if (value === undefined) { |
| 1487 | return null |
| 1488 | } else if (isFragment(value)) { |
| 1489 | const head = value.segments[0] |
| 1490 | if (head._tag === "Custom") { |
| 1491 | const compiled = onCustom(head, placeholder, withoutTransform) |
| 1492 | return compiled[1][0] ?? null |
| 1493 | } else if (head._tag === "Parameter") { |
| 1494 | return head.value |
| 1495 | } |
| 1496 | return null |
| 1497 | } |
| 1498 | return value |
| 1499 | } |
| 1500 | |
| 1501 | const escapeSqlite = defaultEscape("\"") |
| 1502 |
no test coverage detected