pub struct Setup<'a, P: Policy> { /* private fields */ }Expand description
What a connection’s setup may register.
Implementations§
Source§impl<'a, P: Policy> Setup<'a, P>
impl<'a, P: Policy> Setup<'a, P>
Sourcepub fn on_test_connection(
connection: &Connection,
policy: P,
register: impl FnOnce(&Setup<'_, P>) -> Result<()>,
) -> Result<()>
pub fn on_test_connection( connection: &Connection, policy: P, register: impl FnOnce(&Setup<'_, P>) -> Result<()>, ) -> Result<()>
Run register on connection, a connection a test opened itself,
as the setup of a connection judged by policy would run it.
Sourcepub fn scalar_function<T: ToSql>(
&self,
name: &'static str,
arguments: i32,
flags: FunctionFlags,
function: impl Fn(&FunctionCall<'_, P>) -> Result<T> + Send + 'static,
) -> Result<()>
pub fn scalar_function<T: ToSql>( &self, name: &'static str, arguments: i32, flags: FunctionFlags, function: impl Fn(&FunctionCall<'_, P>) -> Result<T> + Send + 'static, ) -> Result<()>
Register function as name. rusqlite turns a function’s panic into
an error that names no bug, so the authorizer catches the panic and
records it as a bug: the statement fails with the bug’s text, and the
app’s call fails with Error::Bug (E15).
Sourcepub fn named_function<T: ToSql>(
&self,
name: &str,
arguments: i32,
flags: FunctionFlags,
function: impl Fn(&Context<'_>) -> Result<T> + Send + 'static,
) -> Result<()>
pub fn named_function<T: ToSql>( &self, name: &str, arguments: i32, flags: FunctionFlags, function: impl Fn(&Context<'_>) -> Result<T> + Send + 'static, ) -> Result<()>
Register function as name, a name only known as the connection
opens. Nothing catches a panic in it: the function ends the process
itself, or doesn’t panic.
Sourcepub fn snapshot_value<T: Clone + Send + 'static>(
&self,
now: impl Fn() -> T + Send + Sync + 'static,
) -> SnapshotValue<T>
pub fn snapshot_value<T: Clone + Send + 'static>( &self, now: impl Fn() -> T + Send + Sync + 'static, ) -> SnapshotValue<T>
A value the host keeps in memory, which now reads, for this
connection’s functions to read as each transaction’s snapshot saw it
(snapshot_values.rs).
Sourcepub fn collation(
&self,
name: &str,
compare: impl Fn(&str, &str) -> Ordering + Send + 'static,
) -> Result<()>
pub fn collation( &self, name: &str, compare: impl Fn(&str, &str) -> Ordering + Send + 'static, ) -> Result<()>
Register compare as the order the collation name gives text.
Sourcepub fn function_names(&self) -> Result<BTreeSet<String>>
pub fn function_names(&self) -> Result<BTreeSet<String>>
The names of the functions registered so far, SQLite’s own included, in lowercase.