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>
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
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>
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
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 Shading
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6), __DB> for Shading
impl UndecoratedInsertRecord<table> for Shading
Auto Trait Implementations§
impl Freeze for Shading
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
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>
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 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>
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 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
Convert
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
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<'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>
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>>>
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>>>
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>>>
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>>>
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>>>>, 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>>>
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>>>
Attempts to load a single record. Read more
source§impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
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.