pub fn register_brotli_functions(conn: &Connection) -> Result<()>Expand description
Register the brotli SQL function with the given SQLite connection.
The function takes a single argument and returns the Brotli compression (blob) of that argument.
The argument can be either a string or a blob.
If the argument is NULL, the result is NULL.
ยงExample
let db = Connection::open_in_memory()?;
register_brotli_functions(&db)?;
let result: Vec<u8> = db.query_row("SELECT brotli('hello')", [], |r| r.get(0))?;
let expected = b"\x0b\x02\x80\x68\x65\x6c\x6c\x6f\x03";
assert_eq!(result, expected);
let result: String = db.query_row("SELECT CAST(brotli_decode(brotli('world')) AS TEXT)", [], |r| r.get(0))?;
let expected = "world";
assert_eq!(result, expected);
let result: bool = db.query_row("SELECT brotli_test(brotli('world'))", [], |r| r.get(0))?;
let expected = true;
assert_eq!(result, expected);