pub struct Tank {
pub name: String,
pub country: Cow<'static, str>,
pub caliber_mm: u16,
pub speed_kmh: f32,
pub is_operational: bool,
pub units_produced: Option<u32>,
}Fields§
§name: String§country: Cow<'static, str>§caliber_mm: u16§speed_kmh: f32§is_operational: bool§units_produced: Option<u32>Trait Implementations§
Source§impl Entity for Tank
impl Entity for Tank
Source§type PrimaryKey<'a> = (&'a String,)
type PrimaryKey<'a> = (&'a String,)
Primary key type. Tuple of the types of the fields forming the primary key.
Source§fn columns() -> &'static [ColumnDef]
fn columns() -> &'static [ColumnDef]
Returns all declared column definitions in declaration order.
Source§fn primary_key_def() -> &'static [&'static ColumnDef]
fn primary_key_def() -> &'static [&'static ColumnDef]
Iterator over columns forming the primary key. Empty iterator means no PK.
Source§fn primary_key<'a>(&'a self) -> Self::PrimaryKey<'a>
fn primary_key<'a>(&'a self) -> Self::PrimaryKey<'a>
Extracts the primary key value(s) from
self.Source§fn unique_defs() -> impl ExactSizeIterator<Item = impl ExactSizeIterator<Item = &'static ColumnDef>>
fn unique_defs() -> impl ExactSizeIterator<Item = impl ExactSizeIterator<Item = &'static ColumnDef>>
Returns an iterator over unique constraint definitions.
Source§fn row_filtered(&self) -> Box<[(&'static str, Value)]>
fn row_filtered(&self) -> Box<[(&'static str, Value)]>
Returns a filtered mapping of column name to value, typically excluding
auto-generated or default-only columns.
Source§fn from_row(row: RowLabeled) -> Result<Self>
fn from_row(row: RowLabeled) -> Result<Self>
Constructs
Self from a labeled database row. Read moreSource§fn find_pk(
executor: &mut impl Executor,
primary_key: &Self::PrimaryKey<'_>,
) -> impl Future<Output = Result<Option<Self>>>
fn find_pk( executor: &mut impl Executor, primary_key: &Self::PrimaryKey<'_>, ) -> impl Future<Output = Result<Option<Self>>>
Finds an entity by primary key. Read more
Source§fn delete_one(
executor: &mut impl Executor,
primary_key: Self::PrimaryKey<'_>,
) -> impl Future<Output = Result<RowsAffected>> + Sendwhere
Self: Sized,
fn delete_one(
executor: &mut impl Executor,
primary_key: Self::PrimaryKey<'_>,
) -> impl Future<Output = Result<RowsAffected>> + Sendwhere
Self: Sized,
Deletes exactly one entity by primary key. Read more
Source§fn create_table(
executor: &mut impl Executor,
if_not_exists: bool,
create_schema: bool,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Sized,
fn create_table(
executor: &mut impl Executor,
if_not_exists: bool,
create_schema: bool,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Sized,
Creates the underlying table (and optionally schema) if requested. Read more
Source§fn drop_table(
executor: &mut impl Executor,
if_exists: bool,
drop_schema: bool,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Sized,
fn drop_table(
executor: &mut impl Executor,
if_exists: bool,
drop_schema: bool,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Sized,
Drops the underlying table (and optionally schema) if requested. Read more
Source§fn insert_one(
executor: &mut impl Executor,
entity: &impl Entity,
) -> impl Future<Output = Result<RowsAffected, Error>> + Send
fn insert_one( executor: &mut impl Executor, entity: &impl Entity, ) -> impl Future<Output = Result<RowsAffected, Error>> + Send
Inserts a single entity row. Read more
Source§fn insert_many<'a, It>(
executor: &mut impl Executor,
items: It,
) -> impl Future<Output = Result<RowsAffected, Error>> + Sendwhere
Self: Sized + 'a,
It: IntoIterator<Item = &'a Self> + Send,
<It as IntoIterator>::IntoIter: Send,
fn insert_many<'a, It>(
executor: &mut impl Executor,
items: It,
) -> impl Future<Output = Result<RowsAffected, Error>> + Sendwhere
Self: Sized + 'a,
It: IntoIterator<Item = &'a Self> + Send,
<It as IntoIterator>::IntoIter: Send,
Multiple insert for a homogeneous iterator of entities. Read more
Source§fn prepare_find<Exec>(
executor: &mut Exec,
condition: &impl Expression,
limit: Option<u32>,
) -> impl Future<Output = Result<Query<<Exec as Executor>::Driver>, Error>>where
Exec: Executor,
fn prepare_find<Exec>(
executor: &mut Exec,
condition: &impl Expression,
limit: Option<u32>,
) -> impl Future<Output = Result<Query<<Exec as Executor>::Driver>, Error>>where
Exec: Executor,
Prepare (but do not yet run) a SQL select query. Read more
Source§fn find_one(
executor: &mut impl Executor,
condition: &impl Expression,
) -> impl Future<Output = Result<Option<Self>, Error>> + Sendwhere
Self: Sized,
fn find_one(
executor: &mut impl Executor,
condition: &impl Expression,
) -> impl Future<Output = Result<Option<Self>, Error>> + Sendwhere
Self: Sized,
Finds the first entity matching a condition expression. Read more
Source§fn find_many(
executor: &mut impl Executor,
condition: impl Expression,
limit: Option<u32>,
) -> impl Stream<Item = Result<Self, Error>> + Sendwhere
Self: Sized,
fn find_many(
executor: &mut impl Executor,
condition: impl Expression,
limit: Option<u32>,
) -> impl Stream<Item = Result<Self, Error>> + Sendwhere
Self: Sized,
Streams entities matching a condition. Read more
Source§fn delete_many(
executor: &mut impl Executor,
condition: &impl Expression,
) -> impl Future<Output = Result<RowsAffected, Error>> + Sendwhere
Self: Sized,
fn delete_many(
executor: &mut impl Executor,
condition: &impl Expression,
) -> impl Future<Output = Result<RowsAffected, Error>> + Sendwhere
Self: Sized,
Deletes all entities matching a condition. Read more
Auto Trait Implementations§
impl Freeze for Tank
impl RefUnwindSafe for Tank
impl Send for Tank
impl Sync for Tank
impl Unpin for Tank
impl UnwindSafe for Tank
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<E> DataSet for Ewhere
E: Entity,
impl<E> DataSet for Ewhere
E: Entity,
Source§fn qualified_columns() -> bool
fn qualified_columns() -> bool
Indicates whether column names should be fully qualified with schema and table name.
For entities this returns false to keep queries concise, for joins it returns true.
Source§fn write_query(
&self,
writer: &dyn SqlWriter,
context: &mut Context,
out: &mut String,
)
fn write_query( &self, writer: &dyn SqlWriter, context: &mut Context, out: &mut String, )
Writes the table reference into the out string.
Source§fn select<'s, Exec, Item, Cols, Expr>(
&'s self,
executor: &'s mut Exec,
columns: Cols,
condition: Expr,
limit: Option<u32>,
) -> impl Stream<Item = Result<RowLabeled, Error>> + 'swhere
Self: Sized,
Exec: Executor,
Item: Expression,
Cols: IntoIterator<Item = Item> + Clone,
Expr: Expression,
fn select<'s, Exec, Item, Cols, Expr>(
&'s self,
executor: &'s mut Exec,
columns: Cols,
condition: Expr,
limit: Option<u32>,
) -> impl Stream<Item = Result<RowLabeled, Error>> + 'swhere
Self: Sized,
Exec: Executor,
Item: Expression,
Cols: IntoIterator<Item = Item> + Clone,
Expr: Expression,
Fetch a SELECT query and stream labeled rows.
Source§fn prepare<Exec, Item, Cols, Expr>(
&self,
executor: &mut Exec,
columns: Cols,
condition: &Expr,
limit: Option<u32>,
) -> impl Future<Output = Result<Query<<Exec as Executor>::Driver>, Error>>where
Self: Sized,
Item: Expression,
Cols: IntoIterator<Item = Item> + Clone,
Exec: Executor,
Expr: Expression,
fn prepare<Exec, Item, Cols, Expr>(
&self,
executor: &mut Exec,
columns: Cols,
condition: &Expr,
limit: Option<u32>,
) -> impl Future<Output = Result<Query<<Exec as Executor>::Driver>, Error>>where
Self: Sized,
Item: Expression,
Cols: IntoIterator<Item = Item> + Clone,
Exec: Executor,
Expr: Expression,
Prepare a SELECT query.