pub struct Seed {Show 15 fields
pub id: i32,
pub name: String,
pub harvest_year: i16,
pub use_by: Option<NaiveDate>,
pub origin: Option<String>,
pub taste: Option<String>,
pub yield_: Option<String>,
pub quantity: Quantity,
pub quality: Option<Quality>,
pub price: Option<i16>,
pub generation: Option<i16>,
pub notes: Option<String>,
pub plant_id: Option<i32>,
pub created_by: Uuid,
pub archived_at: Option<NaiveDateTime>,
}
Expand description
The Seed
entity.
Fields§
§id: i32
The record id of the seed.
name: String
An additional name for the seed.
harvest_year: i16
When the seeds were harvested.
use_by: Option<NaiveDate>
When the seeds should be used by.
origin: Option<String>
Where the seeds came from.
taste: Option<String>
What the seeds taste like.
yield_: Option<String>
The yield of the seeds.
quantity: Quantity
How many seeds there are.
quality: Option<Quality>
The quality of the seeds.
price: Option<i16>
How much the seeds cost.
generation: Option<i16>
How many generations the seeds have been grown.
notes: Option<String>
Notes about the seeds.
plant_id: Option<i32>
The id of the plant this seed belongs to.
created_by: Uuid
The id of the creator of the seed.
archived_at: Option<NaiveDateTime>
Timestamp indicating when the seed was archived. Empty if the seed was not archived.
Implementations§
source§impl Seed
impl Seed
sourcepub async fn find(
search_parameters: SeedSearchParameters,
user_id: Uuid,
page_parameters: PageParameters,
conn: &mut AsyncPgConnection
) -> QueryResult<Page<SeedDto>>
pub async fn find( search_parameters: SeedSearchParameters, user_id: Uuid, page_parameters: PageParameters, conn: &mut AsyncPgConnection ) -> QueryResult<Page<SeedDto>>
Get a page of seeds.
search_parameters.name
filters seeds by their full names (as defined in the documentation).
search_parameters.harvest_year
will only include seeds with a specific harvest year.
search_parameters.archived
specifies if archived seeds, non archived seeds or both kinds
should be part of the results.
By default, archived seeds will not be returned.
If search_parameters.name
is set, seeds will be ordered by how similar they are to the
search_parameters.name
.
Otherwise, seeds are returned in ascending order of their use_by
and harvest_year
dates.
Errors
- Unknown, diesel doesn’t say why it might error.
sourcepub async fn find_by_id(
id: i32,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<SeedDto>
pub async fn find_by_id( id: i32, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<SeedDto>
sourcepub async fn create(
new_seed: NewSeedDto,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<SeedDto>
pub async fn create( new_seed: NewSeedDto, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<SeedDto>
sourcepub async fn edit(
id: i32,
user_id: Uuid,
new_seed: NewSeedDto,
conn: &mut AsyncPgConnection
) -> QueryResult<SeedDto>
pub async fn edit( id: i32, user_id: Uuid, new_seed: NewSeedDto, conn: &mut AsyncPgConnection ) -> QueryResult<SeedDto>
sourcepub async fn delete_by_id(
id: i32,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<usize>
pub async fn delete_by_id( id: i32, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<usize>
sourcepub async fn archive(
id: i32,
archived_at: Option<NaiveDateTime>,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<SeedDto>
pub async fn archive( id: i32, archived_at: Option<NaiveDateTime>, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<SeedDto>
Archive or unarchive a seed in the database.
Errors
If the connection to the database could not be established.
Trait Implementations§
source§impl<'ident> Identifiable for &'ident Seed
impl<'ident> Identifiable for &'ident Seed
source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14), __DB> for Seedwhere
(i32, String, i16, Option<NaiveDate>, Option<String>, Option<String>, Option<String>, Quantity, Option<Quality>, Option<i16>, Option<i16>, Option<String>, Option<i32>, Uuid, Option<NaiveDateTime>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14), __DB> for Seedwhere (i32, String, i16, Option<NaiveDate>, Option<String>, Option<String>, Option<String>, Quantity, Option<Quality>, Option<i16>, Option<i16>, Option<String>, Option<i32>, Uuid, Option<NaiveDateTime>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14), __DB>,
Auto Trait Implementations§
impl RefUnwindSafe for Seed
impl Send for Seed
impl Sync for Seed
impl Unpin for Seed
impl UnwindSafe for Seed
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
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> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,
&self
to an expression for Diesel’s query builder. Read moresource§impl<T, Conn> RunQueryDsl<Conn> for T
impl<T, Conn> RunQueryDsl<Conn> for T
source§fn execute<'query, 'conn>(
self,
conn: &'conn mut Conn
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where
Conn: AsyncConnection + Send,
Self: ExecuteDsl<Conn, <Conn as AsyncConnection>::Backend> + 'query,
fn execute<'query, 'conn>( self, conn: &'conn mut Conn ) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where Conn: AsyncConnection + Send, Self: ExecuteDsl<Conn, <Conn as AsyncConnection>::Backend> + 'query,
source§fn load<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U, Global>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U, Global>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load<'query, U, 'conn>( self, conn: &'conn mut Conn ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U, Global>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U, Global>>>where U: Send, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,
source§fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn ) -> Self::LoadFuture<'conn>where Conn: AsyncConnection, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,
source§fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>, Global>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>, Global>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn ) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>, Global>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>, Global>>)) -> Result<U, Error>>>where U: Send + 'conn, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,
source§fn get_results<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U, Global>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U, Global>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_results<'query, U, 'conn>( self, conn: &'conn mut Conn ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U, Global>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U, Global>>>where U: Send, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,
Vec
with the affected rows. Read more