Skip to main content

escape_literal

Function escape_literal 

Source
pub fn escape_literal(literal: &str) -> String
Expand description

Escapes a SQL string literal.

This is a convenience function that returns the escaped literal as a String. For more efficient formatting, use SqlLiteral directly in format strings.

ยงExample

use hyperdb_api_core::protocol::escape::escape_literal;

assert_eq!(escape_literal("hello"), "'hello'");
assert_eq!(escape_literal("it's"), "'it''s'");