backend::model::entity::plantings

Struct Planting

source
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

source

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.
source

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.
source

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.

source

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 type plant.
  • Unknown, diesel doesn’t say why it might error.
source

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.
source

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.

source

pub async fn delete_by_ids( dto: Vec<DeletePlantingDto>, map_id: i32, user_id: Uuid, conn: &mut AsyncPgConnection, ) -> QueryResult<usize>

Delete the plantings from the database.

§Errors
  • Unknown, diesel doesn’t say why it might error.

Trait Implementations§

source§

impl Clone for Planting

source§

fn clone(&self) -> Planting

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Planting

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Planting> for PlantingDto

source§

fn from(planting: Planting) -> Self

Converts to this type from the input type.
source§

impl HasTable for Planting

source§

type Table = table

The table this type is associated with.
source§

fn table() -> Self::Table

Returns the table this type is associated with.
source§

impl<'ident> Identifiable for &'ident Planting

source§

type Id = &'ident Uuid

The type of this struct’s identifier. Read more
source§

fn id(self) -> Self::Id

Returns the identifier for this record. Read more
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 Planting

source§

type Row = (Uuid, i32, i32, i32, i32, i32, f32, Option<NaiveDate>, Option<NaiveDate>, Option<i32>, bool, String, NaiveDateTime, NaiveDateTime, Uuid, Uuid, Uuid, Option<i32>)

The Rust type you’d like to map from. Read more
source§

fn build(row: Self::Row) -> Result<Self>

Construct an instance of this type

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> IntoSql for T

source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T> Paginate for T

source§

fn paginate(self, page: Option<i32>) -> PaginatedQuery<T>

Return a paginated version of a query for a specific page number.
source§

impl<T, Conn> RunQueryDsl<Conn> for T

source§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnection + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
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>>>
where U: Send, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
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,

Executes the given query, returning a Stream with the returned rows. Read more
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>>>
where U: Send + 'conn, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
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>>>
where U: Send, Conn: AsyncConnection, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
source§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: <Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>) -> Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>>
where U: Send + 'conn, Conn: AsyncConnection, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
where ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,

source§

const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE

The number of fields that this type will consume.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more