IsReservedWordFunction
The type of the optional isReservedWord field on
SerializerExtension, used to decide which bare identifiers must be
escaped (double-quoted) when a dialect has its own reserved-word list. Relevant only to authors of
a dialect/adapter package — not to everyday query building.
type IsReservedWordFunction = (ctx: SerializeContext, s: string) => boolean;
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | SerializeContext | The active serialization context for the whole .generate() call. |
s | string | The bare identifier being checked (e.g. a field or alias name). |
Return true to have the builder escape s (double-quote it) when rendering; false to leave it
unescaped. Field, GroupColumn, and
OrderColumn all consult this via ctx.isReservedWord(...) for
their unqualified field/alias names.
import { SerializerRegistry } from '@sqb/builder';
SerializerRegistry.register({
dialect: 'my-dialect',
isReservedWord(ctx, word) {
return MY_DIALECT_RESERVED_WORDS.has(word.toLowerCase());
},
});