register_fnv_functions

Function register_fnv_functions 

Source
pub fn register_fnv_functions(conn: &Connection) -> Result<()>
Expand description

Register the fnv1a SQL function with the given SQLite connection. The fnv1a function uses Fowler–Noll–Vo hash function to compute the hash of the argument(s).

§Example

let db = Connection::open_in_memory()?;
register_fnv_functions(&db)?;
let hash: Vec<u8> = db.query_row("SELECT fnv1a('hello')", [], |r| r.get(0))?;
let expected = b"\xA4\x30\xD8\x46\x80\xAA\xBD\x0B";
assert_eq!(hash, expected);