pub struct Context<'a> { /* private fields */ }
Expand description
Context is a wrapper for the SQLite function evaluation context.
Implementations§
Source§impl Context<'_>
impl Context<'_>
Sourcepub fn get<T: FromSql>(&self, idx: usize) -> Result<T>
pub fn get<T: FromSql>(&self, idx: usize) -> Result<T>
Returns the idx
th argument as a T
.
§Failure
Will panic if idx
is greater than or equal to
self.len()
.
Will return Err if the underlying SQLite type cannot be converted to a
T
.
Sourcepub fn get_raw(&self, idx: usize) -> ValueRef<'_>
pub fn get_raw(&self, idx: usize) -> ValueRef<'_>
Returns the idx
th argument as a ValueRef
.
§Failure
Will panic if idx
is greater than or equal to
self.len()
.
Sourcepub fn get_arg(&self, idx: usize) -> SqlFnArg
pub fn get_arg(&self, idx: usize) -> SqlFnArg
Returns the idx
th argument as a SqlFnArg
.
To be used when the SQL function result is one of its arguments.
Sourcepub fn get_subtype(&self, idx: usize) -> c_uint
pub fn get_subtype(&self, idx: usize) -> c_uint
Returns the subtype of idx
th argument.
§Failure
Will panic if idx
is greater than or equal to
self.len()
.
Sourcepub fn get_or_create_aux<T, E, F>(&self, arg: c_int, func: F) -> Result<Arc<T>>
pub fn get_or_create_aux<T, E, F>(&self, arg: c_int, func: F) -> Result<Arc<T>>
Fetch or insert the auxiliary data associated with a particular
parameter. This is intended to be an easier-to-use way of fetching it
compared to calling get_aux
and
set_aux
separately.
See https://www.sqlite.org/c3ref/get_auxdata.html
for a discussion of
this feature, or the unit tests of this module for an example.
§Failure
Will panic if arg
is greater than or equal to
self.len()
.
Sourcepub fn set_aux<T: Send + Sync + 'static>(
&self,
arg: c_int,
value: T,
) -> Result<Arc<T>>
pub fn set_aux<T: Send + Sync + 'static>( &self, arg: c_int, value: T, ) -> Result<Arc<T>>
Sets the auxiliary data associated with a particular parameter. See
https://www.sqlite.org/c3ref/get_auxdata.html
for a discussion of
this feature, or the unit tests of this module for an example.
§Failure
Will panic if arg
is greater than or equal to
self.len()
.
Sourcepub fn get_aux<T: Send + Sync + 'static>(
&self,
arg: c_int,
) -> Result<Option<Arc<T>>>
pub fn get_aux<T: Send + Sync + 'static>( &self, arg: c_int, ) -> Result<Option<Arc<T>>>
Gets the auxiliary data that was associated with a given parameter via
set_aux
. Returns Ok(None)
if no data has been
associated, and Ok(Some(v)) if it has. Returns an error if the
requested type does not match.
§Failure
Will panic if arg
is greater than or equal to
self.len()
.
Sourcepub unsafe fn get_connection(&self) -> Result<ConnectionRef<'_>>
pub unsafe fn get_connection(&self) -> Result<ConnectionRef<'_>>
Get the db connection handle via sqlite3_context_db_handle
§Safety
This function is marked unsafe because there is a potential for other references to the connection to be sent across threads, see this comment.
Auto Trait Implementations§
impl<'a> !Crossing for Context<'a>
impl<'a> Freeze for Context<'a>
impl<'a> !ObjSafe for Context<'a>
impl<'a> RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> StoreCopy for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnwindSafe for Context<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more