pub struct SqlContext { /* private fields */ }Expand description
The SQL context used for jobs stored in a SQL database
Implementations§
Source§impl SqlContext
impl SqlContext
Sourcepub fn new() -> SqlContext
pub fn new() -> SqlContext
Build a new context with defaults
Sourcepub fn with_max_attempts(self, max_attempts: i32) -> SqlContext
pub fn with_max_attempts(self, max_attempts: i32) -> SqlContext
Set the number of attempts
Sourcepub fn max_attempts(&self) -> i32
pub fn max_attempts(&self) -> i32
Gets the maximum attempts for a job. Default 25
Sourcepub fn with_done_at(self, done_at: Option<i64>) -> SqlContext
pub fn with_done_at(self, done_at: Option<i64>) -> SqlContext
Set the time a job was done
Sourcepub fn with_lock_at(self, lock_at: Option<i64>) -> SqlContext
pub fn with_lock_at(self, lock_at: Option<i64>) -> SqlContext
Set the lock_at value
Sourcepub fn with_lock_by(self, lock_by: Option<String>) -> SqlContext
pub fn with_lock_by(self, lock_by: Option<String>) -> SqlContext
Set lock_by
Sourcepub fn last_result(&self) -> &Option<Value>
pub fn last_result(&self) -> &Option<Value>
Get the time a job was locked
Sourcepub fn with_last_result(self, result: Option<Value>) -> SqlContext
pub fn with_last_result(self, result: Option<Value>) -> SqlContext
Set the last result
Sourcepub fn with_priority(self, priority: i32) -> SqlContext
pub fn with_priority(self, priority: i32) -> SqlContext
Set the job priority. Larger values will run sooner. Default is 0.
Sourcepub fn with_queue(self, queue: String) -> SqlContext
pub fn with_queue(self, queue: String) -> SqlContext
Set the queue name
Trait Implementations§
Source§impl Clone for SqlContext
impl Clone for SqlContext
Source§fn clone(&self) -> SqlContext
fn clone(&self) -> SqlContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqlContext
impl Debug for SqlContext
Source§impl Default for SqlContext
impl Default for SqlContext
Source§fn default() -> SqlContext
fn default() -> SqlContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SqlContext
impl<'de> Deserialize<'de> for SqlContext
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SqlContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SqlContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Args, IdType> FromRequest<Task<Args, SqlContext, IdType>> for SqlContext
impl<Args, IdType> FromRequest<Task<Args, SqlContext, IdType>> for SqlContext
Source§type Error = Infallible
type Error = Infallible
The error type that can occur during extraction.
Source§async fn from_request(
req: &Task<Args, SqlContext, IdType>,
) -> Result<SqlContext, <SqlContext as FromRequest<Task<Args, SqlContext, IdType>>>::Error>
async fn from_request( req: &Task<Args, SqlContext, IdType>, ) -> Result<SqlContext, <SqlContext as FromRequest<Task<Args, SqlContext, IdType>>>::Error>
Perform the extraction.
Source§impl<T> MetadataExt<T> for SqlContextwhere
T: DeserializeOwned + Serialize,
impl<T> MetadataExt<T> for SqlContextwhere
T: DeserializeOwned + Serialize,
Source§fn extract(&self) -> Result<T, <SqlContext as MetadataExt<T>>::Error>
fn extract(&self) -> Result<T, <SqlContext as MetadataExt<T>>::Error>
Extract metadata of type
T.Source§fn inject(
&mut self,
value: T,
) -> Result<(), <SqlContext as MetadataExt<T>>::Error>
fn inject( &mut self, value: T, ) -> Result<(), <SqlContext as MetadataExt<T>>::Error>
Inject metadata of type
T.Source§impl Serialize for SqlContext
impl Serialize for SqlContext
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SqlContext
impl RefUnwindSafe for SqlContext
impl Send for SqlContext
impl Sync for SqlContext
impl Unpin for SqlContext
impl UnwindSafe for SqlContext
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,
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