Skip to main content

hash_sql

Function hash_sql 

Source
pub fn hash_sql(sql: &str) -> u64
Expand description

Compute a rapidhash of a SQL string.

Uses str::hash() via the Hash trait, matching bsql_core::rapid_hash_str.

let hash = bsql_driver_postgres::hash_sql("SELECT 1");
assert_ne!(hash, 0);
// Same SQL always produces the same hash
assert_eq!(hash, bsql_driver_postgres::hash_sql("SELECT 1"));
// Different SQL produces different hash
assert_ne!(hash, bsql_driver_postgres::hash_sql("SELECT 2"));