roboto.query.roboql_literal#
Module Contents#
- roboto.query.roboql_literal.as_roboql_string_literal(value)#
Render
valueas a double-quoted RoboQL string literal.RoboQL’s grammar admits exactly two escape sequences inside a double-quoted literal,
\"and\\. There is no\n,\t, or\uXXXXform, so every other character is emitted verbatim, non-ASCII included.json.dumpsis therefore not a substitute: it defaults toensure_ascii=True, which renders non-ASCII characters as\uXXXX, a form RoboQL rejects.No codepoint from U+0000 through U+001F, such as a tab or a newline, can be carried by a double-quoted literal. Those characters are emitted unchanged rather than escaped or stripped, so a value containing one yields a query that fails to parse.
- Parameters:
value (str) – Unquoted string to embed in a query, such as a session, topic, or file name.
- Returns:
valuewrapped in double quotes, with backslashes and double quotes escaped.- Return type:
str
Examples
>>> as_roboql_string_literal('a"b') '"a\\"b"' >>> as_roboql_string_literal("café") '"café"'