pub struct EnvInterceptor { /* private fields */ }
Expand description
Read environment variables and fill them in query.
§Example
-- SQLNESS ENV SECRET
SELECT $SECRET;
Environment variables declared in ENV
interceptor will be replaced in the
going to be executed. It won’t be rendered in the result file so you can
safely put secret things in your query.
Note that only decalred and present environment variables will be replaced.
You can either declare multiple env in one intercetor or separate them into different interceptors. The following two examples are equivalent:
-- SQLNESS ENV SECRET1 SECRET2
SELECT $SECRET1, $SECRET2;
-- SQLNESS ENV SECRET1
-- SQLNESS ENV SECRET2
SELECT $SECRET1, $SECRET2;
Trait Implementations§
Source§impl Debug for EnvInterceptor
impl Debug for EnvInterceptor
Source§impl Interceptor for EnvInterceptor
impl Interceptor for EnvInterceptor
fn before_execute(&self, execute_query: &mut Vec<String>, _: &mut QueryContext)
fn before_execute_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
execute_query: &'life1 mut Vec<String>,
context: &'life2 mut QueryContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_execute(&self, result: &mut String)
fn after_execute_async<'life0, 'life1, 'async_trait>(
&'life0 self,
result: &'life1 mut String,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for EnvInterceptor
impl RefUnwindSafe for EnvInterceptor
impl Send for EnvInterceptor
impl Sync for EnvInterceptor
impl Unpin for EnvInterceptor
impl UnwindSafe for EnvInterceptor
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
Mutably borrows from an owned value. Read more