pub struct PluginDatabaseHook {
pub name: String,
pub operation: PluginDatabaseOperation,
pub before: Option<PluginDatabaseBeforeHookHandler>,
pub after: Option<PluginDatabaseAfterHookHandler>,
/* private fields */
}Expand description
Executable database hook registered by a plugin.
Fields§
§name: String§operation: PluginDatabaseOperation§before: Option<PluginDatabaseBeforeHookHandler>§after: Option<PluginDatabaseAfterHookHandler>Implementations§
Source§impl PluginDatabaseHook
impl PluginDatabaseHook
pub fn before<F>(
name: impl Into<String>,
operation: PluginDatabaseOperation,
handler: F,
) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, PluginDatabaseBeforeInput) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn before_async<F>(
name: impl Into<String>,
operation: PluginDatabaseOperation,
handler: F,
) -> Selfwhere
F: for<'a> Fn(PluginDatabaseHookContext<'a>, PluginDatabaseBeforeInput) -> Pin<Box<dyn Future<Output = Result<PluginDatabaseBeforeAction, OpenAuthError>> + Send + 'a>> + Send + Sync + 'static,
pub fn after<F>(
name: impl Into<String>,
operation: PluginDatabaseOperation,
handler: F,
) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &PluginDatabaseAfterInput) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn after_async<F>(
name: impl Into<String>,
operation: PluginDatabaseOperation,
handler: F,
) -> Selfwhere
F: for<'a> Fn(PluginDatabaseHookContext<'a>, PluginDatabaseAfterInput) -> Pin<Box<dyn Future<Output = Result<(), OpenAuthError>> + Send + 'a>> + Send + Sync + 'static,
pub fn before_create<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, Create) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn before_create_async<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: for<'a> Fn(PluginDatabaseHookContext<'a>, Create) -> Pin<Box<dyn Future<Output = Result<PluginDatabaseBeforeAction, OpenAuthError>> + Send + 'a>> + Send + Sync + 'static,
pub fn before_update<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, Update) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn before_update_many<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, UpdateMany) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn before_delete<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, Delete, Vec<DbRecord>) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn before_delete_many<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, DeleteMany, Vec<DbRecord>) -> Result<PluginDatabaseBeforeAction, OpenAuthError> + Send + Sync + 'static,
pub fn after_create<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &Create, &DbRecord) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn after_update<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &Update, &Option<DbRecord>) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn after_update_many<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &UpdateMany, u64) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn after_delete<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &Delete, &[DbRecord]) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn after_delete_many<F>(name: impl Into<String>, handler: F) -> Selfwhere
F: Fn(&PluginDatabaseHookContext<'_>, &DeleteMany, &[DbRecord], u64) -> Result<(), OpenAuthError> + Send + Sync + 'static,
pub fn plugin_id(&self) -> Option<&str>
pub fn with_plugin_id(self, plugin_id: impl Into<String>) -> Self
pub fn has_overlapping_phase(&self, other: &Self) -> bool
Trait Implementations§
Source§impl Clone for PluginDatabaseHook
impl Clone for PluginDatabaseHook
Source§fn clone(&self) -> PluginDatabaseHook
fn clone(&self) -> PluginDatabaseHook
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PluginDatabaseHook
impl !RefUnwindSafe for PluginDatabaseHook
impl Send for PluginDatabaseHook
impl Sync for PluginDatabaseHook
impl Unpin for PluginDatabaseHook
impl UnsafeUnpin for PluginDatabaseHook
impl !UnwindSafe for PluginDatabaseHook
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