assertSqlIdentifier
function assertSqlIdentifier(identifier): string;Defined in: keyset.ts:171
Validate a SQL column identifier. Throws on unsafe input — identifiers must come from your schema map, never from request data.
This intentionally accepts only simple unquoted identifiers like id or
created_at. It rejects dotted paths, quoted identifiers, function calls,
whitespace, and semicolons. If you need computed expressions, wrap a
server-owned string with keysetSqlExpression.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
identifier |
string |
Returns
Section titled “Returns”string
Example
Section titled “Example”assertSqlIdentifier("created_at"); // okassertSqlIdentifier("created_at; DROP TABLE posts"); // throws