pub struct Planting {Show 18 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,
pub height: Option<i32>,
}
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 plantings.
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.
height: Option<i32>
The height of the planting in cm (z direction).
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>>
Get all plantings associated with the query.
§Errors
- Unknown, diesel doesn’t say why it might error.
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>>
Partially update a planting in the database.
§Errors
- Unknown, diesel doesn’t say why it might error.
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, __ST17> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17), __DB> for Plantingwhere
(Uuid, i32, i32, i32, i32, i32, f32, Option<NaiveDate>, Option<NaiveDate>, Option<i32>, bool, String, NaiveDateTime, NaiveDateTime, Uuid, Uuid, Uuid, Option<i32>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17), __DB> for Plantingwhere
(Uuid, i32, i32, i32, i32, i32, f32, Option<NaiveDate>, Option<NaiveDate>, Option<i32>, bool, String, NaiveDateTime, NaiveDateTime, Uuid, Uuid, Uuid, Option<i32>): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17), __DB>,
Auto Trait Implementations§
impl Freeze for Planting
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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 moresource§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&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<'conn, 'query>(
self,
conn: &'conn mut Conn,
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>
fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>
source§fn load<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>
fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>
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>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>
fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>
source§fn get_results<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>
fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>
Vec
with the affected rows. Read more