Rust

quote

Module

Identifier quoting: `users`.`id` for MySQL, "users"."id" for PostgreSQL.

Contents

use utopia_query::quote;
Rust
pub fn quote(identifier: &str, wrap: char) -> Result<String>

Quotes a possibly qualified identifier with wrap: each dot-separated segment is wrapped (the wrap character doubled inside), a final * stays bare, and * alone is returned as is. Control characters are refused.

Rust
use utopia_query::quote;

assert_eq!(quote("schema.users", '`')?, "`schema`.`users`");
assert_eq!(quote("users.*", '"')?, "\"users\".*");
use utopia_query::quote_literal;
Rust
pub fn quote_literal(identifier: &str, wrap: char) -> Result<String>

Quotes one identifier without treating dots as qualifiers (a column named meta.key, as ClickHouse nested columns are).

Rust
use utopia_query::quote_literal;

assert_eq!(quote_literal("meta.key", '`')?, "`meta.key`");