pub struct Model {
pub lease_id: String,
pub owner_id: String,
pub expires_at: DateTimeUtc,
pub last_renewed_at: DateTimeUtc,
pub created_at: DateTimeUtc,
pub updated_at: DateTimeUtc,
}Expand description
SeaORM model for runtime_leases.
Fields§
§lease_id: StringStable lease key shared by all service instances.
owner_id: StringOwner identifier stored by the active process.
expires_at: DateTimeUtcTimestamp after which another owner may take over.
last_renewed_at: DateTimeUtcTimestamp of the last successful acquisition or renewal.
created_at: DateTimeUtcRow creation timestamp.
updated_at: DateTimeUtcRow update timestamp.
Implementations§
Trait Implementations§
Source§impl From<Model> for ActiveModel
impl From<Model> for ActiveModel
Source§impl FromQueryResult for Model
impl FromQueryResult for Model
Source§fn from_query_result(row: &QueryResult, pre: &str) -> Result<Self, DbErr>
fn from_query_result(row: &QueryResult, pre: &str) -> Result<Self, DbErr>
Instantiate a Model from a [QueryResult] Read more
Source§fn from_query_result_nullable(
row: &QueryResult,
pre: &str,
) -> Result<Self, TryGetError>
fn from_query_result_nullable( row: &QueryResult, pre: &str, ) -> Result<Self, TryGetError>
§fn from_query_result_optional(
res: &QueryResult,
pre: &str,
) -> Result<Option<Self>, DbErr>
fn from_query_result_optional( res: &QueryResult, pre: &str, ) -> Result<Option<Self>, DbErr>
Transform the error from instantiating a Model from a [QueryResult]
and converting it to an Option
§fn find_by_statement(stmt: Statement) -> SelectorRaw<SelectModel<Self>>
fn find_by_statement(stmt: Statement) -> SelectorRaw<SelectModel<Self>>
Source§impl IntoActiveModel<ActiveModel> for Model
impl IntoActiveModel<ActiveModel> for Model
Source§fn into_active_model(self) -> ActiveModel
fn into_active_model(self) -> ActiveModel
Method to call to perform the conversion
Source§impl ModelTrait for Model
impl ModelTrait for Model
Source§fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> Value
fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> Value
Read the value of one column.
Source§fn get_value_type(c: <Self::Entity as EntityTrait>::Column) -> ArrayType
fn get_value_type(c: <Self::Entity as EntityTrait>::Column) -> ArrayType
Type of the value stored by a column, used by reflection helpers
such as Arrow conversion.
Source§fn try_set(
&mut self,
c: <Self::Entity as EntityTrait>::Column,
v: Value,
) -> Result<(), DbErr>
fn try_set( &mut self, c: <Self::Entity as EntityTrait>::Column, v: Value, ) -> Result<(), DbErr>
Write a value to one column, returning an error if the value’s type
does not match the column.
§fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value)
fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value)
Write a value to one column. Panics if the value’s type doesn’t match
the column; prefer
try_set when the value comes
from untrusted input.Build a [
Select] for models related to self via the
Self::Entity: Related<R> relation. Use it together with .one(db) /
.all(db) to fetch the related rows.§fn find_linked<L>(&self, l: L) -> Select<<L as Linked>::ToEntity>where
L: Linked<FromEntity = Self::Entity>,
fn find_linked<L>(&self, l: L) -> Select<<L as Linked>::ToEntity>where
L: Linked<FromEntity = Self::Entity>,
Build a [
Select] that follows a multi-hop link out of self. The
hops are described by a [Linked] implementation.§fn delete<'a, 'async_trait, A, C>(
self,
db: &'a C,
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>where
'a: 'async_trait,
Self: IntoActiveModel<A> + 'async_trait,
C: ConnectionTrait + 'async_trait,
A: ActiveModelTrait<Entity = Self::Entity> + ActiveModelBehavior + Send + 'a + 'async_trait,
fn delete<'a, 'async_trait, A, C>(
self,
db: &'a C,
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>where
'a: 'async_trait,
Self: IntoActiveModel<A> + 'async_trait,
C: ConnectionTrait + 'async_trait,
A: ActiveModelTrait<Entity = Self::Entity> + ActiveModelBehavior + Send + 'a + 'async_trait,
Delete a model
§fn get_primary_key_value(&self) -> ValueTuple
fn get_primary_key_value(&self) -> ValueTuple
Get the primary key value of the Model
Source§impl TryFrom<ActiveModel> for Model
impl TryFrom<ActiveModel> for Model
Source§impl TryIntoModel<Model> for ActiveModel
impl TryIntoModel<Model> for ActiveModel
Source§fn try_into_model(self) -> Result<Model, DbErr>
fn try_into_model(self) -> Result<Model, DbErr>
Attempt the conversion, returning an error if a required column is
not set.
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
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> 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>
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§impl<T> PartialModelTrait for Twhere
T: ModelTrait + FromQueryResult,
impl<T> PartialModelTrait for Twhere
T: ModelTrait + FromQueryResult,
§fn select_cols_nested<S>(
select: S,
prefix: Option<&str>,
alias: Option<&'static str>,
) -> Swhere
S: QuerySelect,
fn select_cols_nested<S>(
select: S,
prefix: Option<&str>,
alias: Option<&'static str>,
) -> Swhere
S: QuerySelect,
Used when nesting these structs into each other. Read more
§fn select_cols<S>(select: S) -> Swhere
S: QuerySelect,
fn select_cols<S>(select: S) -> Swhere
S: QuerySelect,
Add the partial model’s columns to a [
QuerySelect]’s projection. Read more§impl<M> TryIntoModel<M> for Mwhere
M: ModelTrait,
impl<M> TryIntoModel<M> for Mwhere
M: ModelTrait,
§fn try_into_model(self) -> Result<M, DbErr>
fn try_into_model(self) -> Result<M, DbErr>
Attempt the conversion, returning an error if a required column is
not set.