pub struct Shading {
pub id: Uuid,
pub layer_id: Uuid,
pub shade: Shade,
pub geometry: Polygon<Point>,
pub add_date: Option<NaiveDate>,
pub remove_date: Option<NaiveDate>,
pub notes: String,
}
Expand description
The Shading
entity.
Fields§
§id: Uuid
The id of the shading.
layer_id: Uuid
The plant layer the shadings is on.
shade: Shade
The type/strength of shade.
geometry: Polygon<Point>
The position of the shade on the map.
add_date: Option<NaiveDate>
The date the shading was added to the map. If None, the shading always existed.
remove_date: Option<NaiveDate>
The date the shading was removed from the map. If None, the shading is still on the map.
notes: String
Markdown notes
Implementations§
source§impl Shading
impl Shading
sourcepub async fn find(
search_parameters: FindShadingsParameters,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<ShadingDto>>
pub async fn find( search_parameters: FindShadingsParameters, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<ShadingDto>>
sourcepub async fn create(
dto_vec: Vec<NewShadingDto>,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<ShadingDto>>
pub async fn create( dto_vec: Vec<NewShadingDto>, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<ShadingDto>>
Create a new shading 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: UpdateShadingDto,
conn: &mut AsyncPgConnection
) -> QueryResult<Vec<ShadingDto>>
pub async fn update( dto: UpdateShadingDto, conn: &mut AsyncPgConnection ) -> QueryResult<Vec<ShadingDto>>
sourcefn do_update(
updates: Vec<UpdateShading>,
conn: &mut AsyncPgConnection
) -> Vec<impl Future<Output = QueryResult<Self>>>
fn do_update( updates: Vec<UpdateShading>, 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(
dtos: Vec<DeleteShadingDto>,
conn: &mut AsyncPgConnection
) -> QueryResult<usize>
pub async fn delete_by_ids( dtos: Vec<DeleteShadingDto>, conn: &mut AsyncPgConnection ) -> QueryResult<usize>
Trait Implementations§
source§impl From<NewShadingDto> for Shading
impl From<NewShadingDto> for Shading
source§fn from(dto: NewShadingDto) -> Self
fn from(dto: NewShadingDto) -> Self
Converts to this type from the input type.
source§impl From<Shading> for ShadingDto
impl From<Shading> for ShadingDto
source§impl<'ident> Identifiable for &'ident Shading
impl<'ident> Identifiable for &'ident Shading
source§impl<'insert> Insertable<table> for &'insert Shading
impl<'insert> Insertable<table> for &'insert Shading
§type Values = <(Option<Grouped<Eq<id, <&'insert Uuid as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<layer_id, <&'insert Uuid as AsExpression<<layer_id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<shade, <&'insert Shade as AsExpression<<shade as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<geometry, <&'insert Polygon<Point> as AsExpression<<geometry as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<add_date, <&'insert NaiveDate as AsExpression<<add_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<remove_date, <&'insert NaiveDate as AsExpression<<remove_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<notes, <&'insert String as AsExpression<<notes as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
type Values = <(Option<Grouped<Eq<id, <&'insert Uuid as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<layer_id, <&'insert Uuid as AsExpression<<layer_id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<shade, <&'insert Shade as AsExpression<<shade as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<geometry, <&'insert Polygon<Point> as AsExpression<<geometry as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<add_date, <&'insert NaiveDate as AsExpression<<add_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<remove_date, <&'insert NaiveDate as AsExpression<<remove_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<notes, <&'insert String as AsExpression<<notes as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
The
VALUES
clause to insert these records Read moresource§fn values(
self
) -> <(Option<Eq<id, &'insert Uuid>>, Option<Eq<layer_id, &'insert Uuid>>, Option<Eq<shade, &'insert Shade>>, Option<Eq<geometry, &'insert Polygon<Point>>>, Option<Eq<add_date, &'insert NaiveDate>>, Option<Eq<remove_date, &'insert NaiveDate>>, Option<Eq<notes, &'insert String>>) as Insertable<table>>::Values
fn values( self ) -> <(Option<Eq<id, &'insert Uuid>>, Option<Eq<layer_id, &'insert Uuid>>, Option<Eq<shade, &'insert Shade>>, Option<Eq<geometry, &'insert Polygon<Point>>>, Option<Eq<add_date, &'insert NaiveDate>>, Option<Eq<remove_date, &'insert NaiveDate>>, Option<Eq<notes, &'insert String>>) as Insertable<table>>::Values
Construct
Self::Values
Read moresource§fn insert_into(
self,
table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>where
T: Table,
Self: Sized,
fn insert_into( self, table: T ) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>where T: Table, Self: Sized,
Insert
self
into a given table. Read moresource§impl Insertable<table> for Shading
impl Insertable<table> for Shading
§type Values = <(Option<Grouped<Eq<id, <Uuid as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<layer_id, <Uuid as AsExpression<<layer_id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<shade, <Shade as AsExpression<<shade as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<geometry, <Polygon<Point> as AsExpression<<geometry as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<add_date, <NaiveDate as AsExpression<<add_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<remove_date, <NaiveDate as AsExpression<<remove_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<notes, <String as AsExpression<<notes as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
type Values = <(Option<Grouped<Eq<id, <Uuid as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<layer_id, <Uuid as AsExpression<<layer_id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<shade, <Shade as AsExpression<<shade as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<geometry, <Polygon<Point> as AsExpression<<geometry as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<add_date, <NaiveDate as AsExpression<<add_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<remove_date, <NaiveDate as AsExpression<<remove_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<notes, <String as AsExpression<<notes as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values
The
VALUES
clause to insert these records Read moresource§fn values(
self
) -> <(Option<Eq<id, Uuid>>, Option<Eq<layer_id, Uuid>>, Option<Eq<shade, Shade>>, Option<Eq<geometry, Polygon<Point>>>, Option<Eq<add_date, NaiveDate>>, Option<Eq<remove_date, NaiveDate>>, Option<Eq<notes, String>>) as Insertable<table>>::Values
fn values( self ) -> <(Option<Eq<id, Uuid>>, Option<Eq<layer_id, Uuid>>, Option<Eq<shade, Shade>>, Option<Eq<geometry, Polygon<Point>>>, Option<Eq<add_date, NaiveDate>>, Option<Eq<remove_date, NaiveDate>>, Option<Eq<notes, String>>) as Insertable<table>>::Values
Construct
Self::Values
Read moresource§fn insert_into(
self,
table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>where
T: Table,
Self: Sized,
fn insert_into( self, table: T ) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>where T: Table, Self: Sized,
Insert
self
into a given table. Read moresource§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6), __DB> for Shadingwhere
(Uuid, Uuid, Shade, Polygon<Point>, Option<NaiveDate>, Option<NaiveDate>, String): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6), __DB>,
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6), __DB> for Shadingwhere (Uuid, Uuid, Shade, Polygon<Point>, Option<NaiveDate>, Option<NaiveDate>, String): FromStaticSqlRow<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6), __DB>,
impl UndecoratedInsertRecord<table> for Shading
Auto Trait Implementations§
impl RefUnwindSafe for Shading
impl Send for Shading
impl Sync for Shading
impl Unpin for Shading
impl UnwindSafe for Shading
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<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,
Convert
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,
Convert
&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,
Executes the given command, returning the number of rows affected. Read more
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,
Runs the command, and returns the affected row. Read more
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,
Runs the command, returning an
Vec
with the affected rows. Read moresource§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>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>, Global>>)) -> 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>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>, Global>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LimitDsl,
Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,
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>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>, Global>>)) -> 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>, Global>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>, Global>>)) -> 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, ST, DB> StaticallySizedRow<ST, DB> for Twhere
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,
source§const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
The number of fields that this type will consume.