| 385 | * @since 1.0.0 |
| 386 | */ |
| 387 | export const makeCompiler = (transform?: (_: string) => string) => |
| 388 | Statement.makeCompiler<ClickhouseCustom>({ |
| 389 | dialect: "sqlite", |
| 390 | placeholder(i, u) { |
| 391 | return `{p${i}: ${typeFromUnknown(u)}}` |
| 392 | }, |
| 393 | onIdentifier: transform ? |
| 394 | function(value, withoutTransform) { |
| 395 | return withoutTransform ? escape(value) : escape(transform(value)) |
| 396 | } : |
| 397 | escape, |
| 398 | onRecordUpdate() { |
| 399 | return ["", []] |
| 400 | }, |
| 401 | onCustom(type, placeholder) { |
| 402 | return [placeholder(type), [type.i1]] |
| 403 | } |
| 404 | }) |
| 405 | |
| 406 | // compiler helpers |
| 407 | |