pub struct Planting {Show 17 fields
pub id: Uuid,
pub plant_id: i32,
pub x: i32,
pub y: i32,
pub size_x: i32,
pub size_y: i32,
pub rotation: f32,
pub add_date: Option<NaiveDate>,
pub remove_date: Option<NaiveDate>,
pub seed_id: Option<i32>,
pub is_area: bool,
pub notes: String,
pub created_at: NaiveDateTime,
pub modified_at: NaiveDateTime,
pub created_by: Uuid,
pub modified_by: Uuid,
pub layer_id: Uuid,
}
Expand description
The Planting
entity.
Fields§
§id: Uuid
The id of the planting.
plant_id: i32
The plant that is planted.
x: i32
The x coordinate of the position on the map.
y: i32
The y coordinate of the position on the map.
size_x: i32
The size of the planting on the map in x direction.
size_y: i32
The size of the planting on the map in y direction.
rotation: f32
The rotation in degrees (0-360) of the plant on the map.
add_date: Option<NaiveDate>
The date the planting was added to the map. If None, the planting always existed.
remove_date: Option<NaiveDate>
The date the planting was removed from the map. If None, the planting is still on the map.
seed_id: Option<i32>
Plantings may be linked with a seed.
is_area: bool
Is the planting an area of plants.
notes: String
Notes about the planting in Markdown.
created_at: NaiveDateTime
The datetime the planting was created.
modified_at: NaiveDateTime
The datetime the planting was last modified.
created_by: Uuid
The uuid of the user that created the planting.
modified_by: Uuid
The uuid of the user that last modified the planting.
layer_id: Uuid
The plant layer the plantings is on.
Implementations§
source§impl Planting
impl Planting
sourcepub async fn find(
search_parameters: FindPlantingsParameters,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<PlantingDto>>
pub async fn find( search_parameters: FindPlantingsParameters, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<PlantingDto>>
sourcepub async fn find_by_seed_id(
seed_id: i32,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<PlantingDto>>
pub async fn find_by_seed_id( seed_id: i32, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<PlantingDto>>
Get all plantings that have a specific seed id.
Errors
- Unknown, diesel doesn’t say why it might error.
sourceasync fn set_end_date_according_to_cycle_types(
conn: &mut AsyncPgConnection,
plantings: &mut Vec<NewPlanting>
) -> QueryResult<()>
async fn set_end_date_according_to_cycle_types( conn: &mut AsyncPgConnection, plantings: &mut Vec<NewPlanting> ) -> QueryResult<()>
Helper that sets end_date
according to the life_cycle
.
sourcepub async fn create(
dto_vec: Vec<PlantingDto>,
map_id: i32,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<PlantingDto>>
pub async fn create( dto_vec: Vec<PlantingDto>, map_id: i32, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<PlantingDto>>
Create a new planting in the database.
Errors
- If the
layer_id
references a layer that is not of typeplant
. - Unknown, diesel doesn’t say why it might error.
sourcepub async fn update(
dto: UpdatePlantingDto,
map_id: i32,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<PlantingDto>>
pub async fn update( dto: UpdatePlantingDto, map_id: i32, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<PlantingDto>>
sourcefn do_update(
updates: Vec<UpdatePlanting>,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> Vec<impl Future<Output = QueryResult<Self>>>
fn do_update( updates: Vec<UpdatePlanting>, user_id: Uuid, conn: &mut AsyncPgConnection ) -> Vec<impl Future<Output = QueryResult<Self>>>
Performs the actual update of the plantings using pipelined requests.
See diesel_async::AsyncPgConnection
for more information.
Because the type system can not easily infer the type of futures
this helper function is needed, with explicit type annotations.
sourcepub async fn delete_by_ids(
dto: Vec<DeletePlantingDto>,
map_id: i32,
user_id: Uuid,
conn: &mut AsyncPgConnection
) -> QueryResult<usize>
pub async fn delete_by_ids( dto: Vec<DeletePlantingDto>, map_id: i32, user_id: Uuid, conn: &mut AsyncPgConnection ) -> QueryResult<usize>
Trait Implementations§
source§impl From<Planting> for PlantingDto
impl From<Planting> for PlantingDto
source§impl<'ident> Identifiable for &'ident Planting
impl<'ident> Identifiable for &'ident Planting
source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16), __DB> for Plantingwhere
(Uuid, i32, i32, i32, i32, i32, f32, Option<NaiveDate>, Option<NaiveDate>, Option<i32>, bool, String, NaiveDateTime, NaiveDateTime, Uuid, Uuid, Uuid): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16), __DB> for Plantingwhere (Uuid, i32, i32, i32, i32, i32, f32, Option<NaiveDate>, Option<NaiveDate>, Option<i32>, bool, String, NaiveDateTime, NaiveDateTime, Uuid, Uuid, Uuid): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16), __DB>,
Auto Trait Implementations§
impl RefUnwindSafe for Planting
impl Send for Planting
impl Sync for Planting
impl Unpin for Planting
impl UnwindSafe for Planting
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