pub struct Event {
pub name: String,
pub schema: Option<String>,
pub schedule: String,
pub command: String,
pub database: Option<String>,
pub username: Option<String>,
pub ddl: String,
pub enabled: bool,
}Expand description
Represents a database event (pg_cron job)
Fields§
§name: String§schema: Option<String>§schedule: String§command: String§database: Option<String>§username: Option<String>§ddl: String§enabled: boolImplementations§
Source§impl Event
impl Event
Sourcepub fn new(
name: impl Into<String>,
schedule: impl Into<String>,
command: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, schedule: impl Into<String>, command: impl Into<String>, ) -> Self
Create a new event with the given name, schedule, and command
Sourcepub fn with_schema(
schema: impl Into<String>,
name: impl Into<String>,
schedule: impl Into<String>,
command: impl Into<String>,
) -> Self
pub fn with_schema( schema: impl Into<String>, name: impl Into<String>, schedule: impl Into<String>, command: impl Into<String>, ) -> Self
Create a new event with schema
Sourcepub fn with_database(self, database: impl Into<String>) -> Self
pub fn with_database(self, database: impl Into<String>) -> Self
Set the target database for the event
Sourcepub fn with_username(self, username: impl Into<String>) -> Self
pub fn with_username(self, username: impl Into<String>) -> Self
Set the username for the event execution
Sourcepub fn with_custom_ddl(self, ddl: impl Into<String>) -> Self
pub fn with_custom_ddl(self, ddl: impl Into<String>) -> Self
Set custom DDL for the event
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Set whether the event is enabled
Sourcepub fn generate_ddl(&self) -> String
pub fn generate_ddl(&self) -> String
Generate the DDL for creating this event
Sourcepub fn generate_drop_ddl(&self) -> String
pub fn generate_drop_ddl(&self) -> String
Generate the DDL for dropping this event
Trait Implementations§
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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