Struct backend::model::entity::Plants

source ·
pub struct Plants {
Show 37 fields pub id: i32, pub unique_name: String, pub common_name_en: Option<Vec<Option<String>>>, pub common_name_de: Option<Vec<Option<String>>>, pub family: Option<String>, pub edible_uses_en: Option<String>, pub functions: Option<String>, pub heat_zone: Option<i16>, pub shade: Option<Shade>, pub soil_ph: Option<Vec<Option<SoilPh>>>, pub soil_texture: Option<Vec<Option<SoilTextureEnum>>>, pub ecosystem_niche: Option<String>, pub deciduous_or_evergreen: Option<DeciduousOrEvergreen>, pub herbaceous_or_woody: Option<HerbaceousOrWoody>, pub life_cycle: Option<Vec<Option<LifeCycle>>>, pub growth_rate: Option<Vec<Option<GrowthRate>>>, pub height: Option<i32>, pub fertility: Option<Vec<Option<Fertility>>>, pub created_at: NaiveDateTime, pub updated_at: NaiveDateTime, pub has_drought_tolerance: Option<bool>, pub tolerates_wind: Option<bool>, pub preferable_permaculture_zone: Option<i16>, pub hardiness_zone: Option<String>, pub light_requirement: Option<Vec<Option<LightRequirement>>>, pub water_requirement: Option<Vec<Option<WaterRequirementEnum>>>, pub propagation_method: Option<Vec<Option<PropagationMethod>>>, pub alternate_name: Option<String>, pub edible: Option<bool>, pub edible_parts: Option<Vec<Option<String>>>, pub spread: Option<i32>, pub warning: Option<String>, pub version: Option<i16>, pub external_source: Option<ExternalSource>, pub sowing_outdoors: Option<Vec<Option<i16>>>, pub harvest_time: Option<Vec<Option<i16>>>, pub seed_weight_1000: Option<f64>,
}
Expand description

The Plants entity builds up an hierarchical structure, see /doc/database/hierarchy.md:

§Hierarchy

This document explains the hierarchy of the plants table. Please make sure that you already read the biology section of the glossary.

§Introduction

The plants table contains entries of:

  • concrete plants, or
  • abstract plants (representants of ranks)

Concrete plants can be:

  • dragged and dropped to the map and
  • used as seed entry.

Abstract plants can be:

  • used to inherit attributes.

A concrete plant can be of following rank:

  • on species level, or
  • on variety level, or
  • on cultivar level.

Furthermore following must be true:

  • genus is below a family,
  • specie is below a genus,
  • a variety is below a specie,
  • a cultivar is below to a specie or a variety

The diagram below shows the hierarchy of entities with height and width as an example of attribute classification.

classDiagram

  class Family:::abstract {
    +int height
    +int width
  }
  class Genus:::abstract {
    +int height
    +int width
  }
  class Species {
    +int height
    +int width
  }
  class Variety {
    +int height
    +int width
  }
  class Cultivar {
    +int height
    +int width
  }

  Variety <|-- Cultivar
  Species <|-- Cultivar
  Species <|-- Variety
  Genus <|-- Species
  Family <|-- Genus

Each of these entities can have their own attributes. E.g., a variety below a specie can have different height than the specie itself.

§Unique Name

In the database we have a column unique_name. The unique name are, either for abstract plants:

  • single latin word to specify “family”, which always ends on: -aceae
  • single latin word to specify “genus”

Or is built up by several words (for concrete plants):

  • single latin word to specify “genus”
  • single latin word to specify “specie”
  • optional single latin word to specify “variety”
  • optional several words in single quotes to specify “cultivar”, which starts with a capital letter

E.g. Brassica oleracea italica 'Ramoso calabrese'

§Hybrid Names

Hybrid names are built up differently. Either two parent binomials, separated by a “x” or “×” or a given binomial, with or without an intercalated “×” (see Wikipedia). So the name does not necessarily say if a plant is a hybrid.

There is no special handling of hybrid names necessary, as the hybrid name is stored as unique name in the database.

§Displaying the Unique Name

The unique name of a plant should be displayed as follows:

  • Latin name should be displayed in italics.
  • The cultivar name should be in regular font, enclosed in single quotes (as stored in the database).

For example: Brassica oleracea italica ‘Ramoso calabrese’

The unique name alone usually is not displayed.

§Displaying the Complete Name

The complete name of a plant should be displayed as follows:

  • If there is a common name, the common name appears first and should start with a capital letter (e.g., “tomato” becomes “Tomato”).
  • If it is a plant name from the seed database, the name continues with hyphen - and the additional name.
  • This is followed by the unique name in brackets, unique name as described above in Unique Name.

The general format is:

Common name - additional name (unique name)

In cases where the common name is not available in the current language, it should be displayed as:

unique name - additional name

The cultivar is a part of the unique name.

For example (assuming Brassica oleracea italica doesn’t have a common name):

  • Italian broccoli - violett (Brassica oleracea italica ‘Ramoso calabrese’)
  • Italian broccoli - violett (Brassica oleracea italica)
  • Italian broccoli (Brassica oleracea italica)
  • Brassica oleracea italica ‘Ramoso calabrese’ - violett
  • Brassica oleracea italica ‘Ramoso calabrese’
  • Brassica oleracea italica - violett
  • Brassica oleracea italica

§Displaying the Short Name

The short name should be displayed as follows:

  • Common name or, if common name is not not available, the unique name as described above in Unique Name.
  • If additional name is available, - and the additional name should be appended.

For example (assuming Abies mariesii and Brassica oleracea italica don’t have common names):

  • Tomato - Gelbe Birne
  • Abies mariesii
  • Brassica oleracea italica ‘Ramoso calabrese’ - violett

§Usage of Plant Names

  • The short name is for overview, e.g. when you see all labels in the map editor at once (plant labels).
  • The complete name should always be given if the user wants to know precisely which plant she is dealing with, e.g.:
    • when the mouse is hovering over a plant in the plant layer,
    • in search results or
    • in plant details (left bottom toolbar).
  • The additional name must always be added if a plant is connected with a seed.

§Rules

We know about names (abstract and concrete, including hybrid):

  • If it contains more than one word, it is a concrete plant.
  • If it contains only one word, it is an abstract plant (family or genus).
  • All entries with 2 words are a specie (de: Art),
  • All entries with 3 or more words are either:
    • variety (de: Varietät) if all is spelled italic, or
    • are cultivar (de: Sorte) if last part of the name (can be more than 1 word!) is not latin, not italic, is in ‘single quotes’
  • All entries with a single x between the words are hybrid. We treat them like specie.

§Attributes

Columns are documented in their respective structs.

We prefer strongly-typed data, e.g.:

  • enums
  • array of enums
  • numbers

Columns that contain text should be postfixed with:

  • _en for English text
  • _de for German text

As we often copy data from other sources, we maintain following columns for external references:

  • external_source: an array from enum where the first entry is the “main source” the other columns refer to:
  • external_id: an identifier of that source
  • external_url: the URL from where the data was taken

Plants are additionally classified as:

  • is_concrete_plant (is a concrete plant as opposite to an abstract plant)
  • is_tree (as search help within the tree layer)

§from Permapeople

Following columns are removed:

  • environment (and its references)
  • type and is_variety, as variety is now determined from the name (rank to be calculated from name, see above)
  • wildflower
  • plants_of_the_world_online_name_synonym (redundant to link)
  • dutch_name, danish_name, french_name
  • when_to_harvest
  • propagation_cuttings
  • alternate_scientific_name
  • hortipedia
  • invasive_in
  • years_to_bear
  • useful_tropical_plants
  • thinning
  • light_tolerance
  • chill_hours, beef_tomato, invasive
  • folder_name (at least in DB)
  • native_climate_zones
  • adapted_climate_zones
  • propagation_direct_sowing

Other minor problems:

  • fix Labiatae to be lamiaceae (family rank)
  • Remove all “var.” from the database entries (staying with the 3 words).

§from Reinsaat

Unique name:

  • use Scientific name subheading together with name (as cultivar, see above) for our unique_name (Cucurbita ssp. from Scientific name kulturhinweise shouldn’t exist)
  • Remove all occurrences of L., MIll., and var..
  • Entries on Reinsaat that are spelled like “Brassica oleracea convar. botrytis var. italica” https://www.reinsaat.at/shop/EN/brassica/broccoli/limba/ exist in our database as “Brassica oleracea italica”. Add the Reinsaat entry to our database in a different row with the following nomenclature: Brassica oleracea italica ‘Limba’, with Brassica oleracea italica as parent, by following rules:
    • Remove the term “convar.” and its following word.
    • Remove the “ssp.” and its following word.
  • The name maps to cultivar (de: Sorte), i.e. a rank below variety and is expressed in non-latin words, such as ‘Limba’. In our database we want them:
    • back together in one name (the unique name, as described above) e.g. Brassica oleracea italica ‘Limba’ or Malus domestica ‘Gala’.
    • with a link to the variety, if present, otherwise species

Individual problems:

  • Daucus carota L. ssp. sativus –> Daucus carota sativus
  • Petroselinum crispum ssp. tuberosum –> Petroselinum crispum tuberosum
  • Papaver somnif. var. paeonifl. –> Papaver somniferum paeoniflorum
  • Alcea rosea fl. pl. –> Alcea rosea flore pleno
  • Campanula lat. macr. –> Campanula latifolia macrantha
  • Malva sylvestris ssp. maur. –> Malva sylvestris mauritiana
  • Sonnenblume, Velvet Queen: None should be Helianthus annuus

§Further Readings

Fields§

§id: i32
  • The internal id of the plant.
  • Fill ratio: 100%
§unique_name: String
  • The unique name of the plant.
  • The structure is described above (doc/database/hierarchy.md).
  • Fill ratio: 100%
§common_name_en: Option<Vec<Option<String>>>
  • The list of the common names of the plant in English.
  • Fetched from PracticalPlants and Permapeople.
  • Fill ratio: 90%
§common_name_de: Option<Vec<Option<String>>>
  • The list of the common names of the plant in German.
  • Fetched from Wikidata API if not present in any source datasets.
  • Fill ratio: 25%
§family: Option<String>
  • Family of the plant.
  • See /doc/architecture/glossary.md.
  • Used to build up hierarchy.
  • Fetched from PracticalPlants and Permapeople.
  • Fill ratio: 88%
§edible_uses_en: Option<String>
  • TODO: comment out
  • The edible use of the plant, answering: Which food type can be produced from this plant, e.g. oil?
  • Interesting for search functionality.
  • Fetched from Permapeople as edible_uses and merged with Reinsaat.
  • Fill ratio: 6%
§functions: Option<String>
  • TODO: use in search (and attribute)
  • Used for search ranking (diversity).
  • ecological and environmental function of the plant, especially nitrogen fixer is relevant for PermaplanT.
  • Fetched from PracticalPlants)
  • Fill ratio: 13%
§heat_zone: Option<i16>
  • TODO: comment out
  • Not used.
  • Use hardiness_zone instead.
  • indication of the heat range a plant endures.
  • Fetched from PracticalPlants.
  • Fill ratio: 0.05%
§shade: Option<Shade>
  • Shade tolerance of the plant, to be used together with light_requirement.
  • Used in shade layer.
  • For example a plant that has “no shade”, should get a warning if placed in a shade.
  • No shade: full sun exposure
  • Light shade: moderately shaded throughout the day
  • Partial shade: about 3-6 hours of direct sunlight
  • Permanent shade: less than 3 hours of direct sunlight
  • Shade indicates the shade tolerance. Plants obviously grow better with better light conditions.
  • Warnings should only show if a plant is moved into a too dark spot. No warning should be shown when moved into a lighter spot.
  • Fetched from PracticalPlants.
  • Fill ratio: 63%
§soil_ph: Option<Vec<Option<SoilPh>>>
  • TODO: comment out
  • Currently unused (maybe later used in pH layer).
  • See explanation in /doc/architecture/context.md
  • Soil PH can be tested by the user with simple means (e.g. litmus).
  • Fetched from PracticalPlants and Permapeople (merged between Permapeople and PracticalPlants).
  • Fill ratio: 1%
§soil_texture: Option<Vec<Option<SoilTextureEnum>>>
  • See explanation in /doc/architecture/context.md
  • Used in soil layer.
  • Fetched from PracticalPlants and Permapeople (merged with soil_type of Permapeople).
  • Fill ratio: 88%
§ecosystem_niche: Option<String>
  • TODO: comment out
  • Interesting for search functionality.
  • Fetched from PracticalPlants
  • informs about the (vertical) layer, that the plant usually inhabits, e.g. soil surface or canopy
  • Fill ratio: 16%
§deciduous_or_evergreen: Option<DeciduousOrEvergreen>
  • TODO: use in search (and attribute)
  • Only informational.
  • deciduous = plants loose leaves in winter.
  • evergreen = Plants don’t throw leaves (e.g. pine tree).
  • Not applicable for annual plants.
  • Fetched from PracticalPlants and merged with leaves of Permapeople.
  • Fill ratio: 30%
§herbaceous_or_woody: Option<HerbaceousOrWoody>
  • TODO: use in attribute
  • Only informational.
  • Fetched from PracticalPlants
  • informs about the plant physiology
  • woody = grows woody parts
  • herbaceous = doesn’t grow wood, shoots remain soft/green.
  • Fill ratio: 26%
§life_cycle: Option<Vec<Option<LifeCycle>>>
  • Use in search (and attribute)
  • Determines life span of the plant.
  • Fetched from PracticalPlants and Permapeople (merged with life_cycle of Permapeople).
  • Fill ratio: 68%
§growth_rate: Option<Vec<Option<GrowthRate>>>
  • TODO: comment out
  • Only informational.
  • Fetched from PracticalPlants and Permapeople (merged with growth of Permapeople).
  • Fill ratio: 30%
§height: Option<i32>
  • Only informational, is in rw attribute
  • Fetched from PracticalPlants as mature_size_height and merged with Permapeople.
  • informs about the maximum height that the plant gains in cm
  • Fill ratio: 80%
§fertility: Option<Vec<Option<Fertility>>>
  • TODO: comment out
  • Only informational.
  • Fetched from PracticalPlants
  • Fill ratio: 18%
§created_at: NaiveDateTime
  • Is readonly in attribute
  • The creation date of the entry.
  • Only for administration.
  • Fill ratio: 100%
§updated_at: NaiveDateTime
  • Is readonly in attribute
  • The last update date of the entry.
  • Only for administration.
  • Fill ratio: 100%
§has_drought_tolerance: Option<bool>
  • ! TODO: show in attributes and search (icon)
  • Will be used in watering layer.
  • Fetched from PracticalPlants and merged with has_drought_tolerance of Permapeople.
  • Fill ratio: 57%
§tolerates_wind: Option<bool>
  • TODO: comment out
  • Fetched from PracticalPlants.
  • Fill ratio: 10%
§preferable_permaculture_zone: Option<i16>
  • TODO: comment out
  • Not used.
  • Number value between -1..6 (-1 should be printed as 00)
  • Fill ratio: 0%
§hardiness_zone: Option<String>
  • TODO: show in search
  • USDA Hardiness Zone (without subranges).
  • Important information.
  • Fetched from PracticalPlants and Permapeople (merged with usda_hardiness_zone of Permapeople).
  • Fill ratio: 63%
§light_requirement: Option<Vec<Option<LightRequirement>>>
  • Shade tolerance of the plant, to be used together with shade.
  • Used in shade layer.
  • For example a plant that has “Full sun”, should get a warning if placed in a shade.
  • Fetched from* PracticalPlants and Permapeople (merged with sun of PracticalPlants)
  • Full sun: full sun exposure
  • Partial sun/shade: about 3-6 hours of direct sunlight or moderately shaded throughout the day
  • Full shade: less than 3 hours of direct sunlight or almost no sunlight/no direct sunlight
  • Fill ratio: 88%
§water_requirement: Option<Vec<Option<WaterRequirementEnum>>>
  • Used in hydrology layer.
  • Fetched from PracticalPlants and Permapeople (merged with water of PracticalPlants).
  • water = completely aquatic;
  • wet = drowned, (often) flooded or in general very moist, e.g. swamp;
  • moist = humid, regular water supply, e.g. flat bed with humus;
  • well drained = dry, little water input.
  • Fill ratio: 88%
§propagation_method: Option<Vec<Option<PropagationMethod>>>
  • TODO: comment out
  • Only informational.
  • Fetched from Permapeople (renamed from propagation)
  • How to reproduce a plant: cuttings = cut pieces of wood; layering = let low branches reach the soil to root; Seed - direct sow = sow directly the seeds; division = split the rhizomes (roots) into pieces; Spores = plant reproduces via spores (e.g. ferns, funghi); seed - transplant = raise indoors from seed and transplant to outdoors later
  • Fill ratio: 0.9%
§alternate_name: Option<String>
  • TODO: comment out
  • Only informational.
  • May be used in search functionality (low priority).
  • Fetched from Permapeople.
  • Fill ratio: 35%
§edible: Option<bool>
  • TODO: use in search (and as attribute)
  • Important information.
  • Fetched from Permapeople.
  • Fill ratio: 62%
§edible_parts: Option<Vec<Option<String>>>
  • TODO: use as attribute (translation in frontend)
  • Only informational.
  • Fetched from Permapeople.
  • which organ of the plant can be eaten, e.g. root, leaves.
  • Fill ratio: 61%
§spread: Option<i32>
  • Used
  • How far a plant spreads (The ‘width’ of a plant) in cm
  • Fetched from Permapeople.
  • Fill ratio: 0.1%
§warning: Option<String>
  • TODO: use in search (and as attribute)
  • Important information.
  • Fetched from Permapeople.
  • specific warnings for eather human, animal or environmental well-being, e.g. toxic, invasive.
  • Fill ratio: 8%
§version: Option<i16>
  • TODO: add to attributes
  • Only for administration.
  • The version of the entry.
  • To be incremented after every relevant change.
  • Fetched from Permapeople.
  • Fill ratio: 90%
§external_source: Option<ExternalSource>
  • TODO: comment out
  • Not used.
  • Enum value indicating the source of the entry.
  • Fill ratio: 100%
§sowing_outdoors: Option<Vec<Option<i16>>>
  • TODO: use as attribute
  • String array of numbers representing a time period.
  • The year is divided into 24 periods of half a month each.
  • For example “[8,9,10]” means from the 2nd half of April to the 2nd half of May incl.
  • Fetched from Reinsaat
  • Aussaat/ Pflanzung Freiland should be called sowing_outdoors
  • Fill ratio: 5%
§harvest_time: Option<Vec<Option<i16>>>
  • TODO: use as attribute
  • String array of numbers representing a time period.
  • The year is divided into 24 periods of half a month each.
  • For example “[8,9,10]” means from the 2nd half of April to the 2nd half of May incl.
  • Ernte should be called harvest_time
  • Fetched from Reinsaat
  • Fill ratio: 6%
§seed_weight_1000: Option<f64>
  • TODO: comment out
  • Number for thousand grain weight (German: Tausendkornmasse)
  • Used in doc/usecases/buy_seeds.md to calculate seed weight based on number of plants.
  • Fetched from Permapeople as 1000_seed_weight_g and renamed.
  • TODO: merge with data from reinsaat: Tausendkorngewicht (TKG) should be copied to seed_weight (remove g)
  • Fill ratio: 4%

Implementations§

source§

impl Plants

source

pub async fn search( search_query: &str, page_parameters: PageParameters, conn: &mut AsyncPgConnection, ) -> QueryResult<Page<PlantsSummaryDto>>

Get the top plants matching the search query.

Uses pg_trgm to find matches in unique_name, common_name_de, common_name_en and edible_uses_en. Ranks them using the pg_trgm function similarity().

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

pub async fn find_any( page_parameters: PageParameters, conn: &mut AsyncPgConnection, ) -> QueryResult<Page<PlantsSummaryDto>>

Get a page of some plants.

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

pub async fn find_by_id( id: i32, conn: &mut AsyncPgConnection, ) -> QueryResult<PlantsSummaryDto>

Fetch plant by id from the database.

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

Trait Implementations§

source§

impl Debug for Plants

source§

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

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

impl From<Plants> for PlantsSummaryDto

source§

fn from(plants: Plants) -> Self

Converts to this type from the input type.
source§

impl HasTable for Plants

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 Plants

source§

type Id = &'ident i32

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, __ST18, __ST19, __ST20, __ST21, __ST22, __ST23, __ST24, __ST25, __ST26, __ST27, __ST28, __ST29, __ST30, __ST31, __ST32, __ST33, __ST34, __ST35, __ST36> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17, __ST18, __ST19, __ST20, __ST21, __ST22, __ST23, __ST24, __ST25, __ST26, __ST27, __ST28, __ST29, __ST30, __ST31, __ST32, __ST33, __ST34, __ST35, __ST36), __DB> for Plants

source§

impl<__DB: Backend> QueryableByName<__DB> for Plants
where i32: FromSql<SqlTypeOf<id>, __DB>, String: FromSql<SqlTypeOf<unique_name>, __DB>, Option<Vec<Option<String>>>: FromSql<SqlTypeOf<common_name_en>, __DB> + FromSql<SqlTypeOf<common_name_de>, __DB> + FromSql<SqlTypeOf<edible_parts>, __DB>, Option<String>: FromSql<SqlTypeOf<family>, __DB> + FromSql<SqlTypeOf<edible_uses_en>, __DB> + FromSql<SqlTypeOf<functions>, __DB> + FromSql<SqlTypeOf<ecosystem_niche>, __DB> + FromSql<SqlTypeOf<hardiness_zone>, __DB> + FromSql<SqlTypeOf<alternate_name>, __DB> + FromSql<SqlTypeOf<warning>, __DB>, Option<i16>: FromSql<SqlTypeOf<heat_zone>, __DB> + FromSql<SqlTypeOf<preferable_permaculture_zone>, __DB> + FromSql<SqlTypeOf<version>, __DB>, Option<Shade>: FromSql<SqlTypeOf<shade>, __DB>, Option<Vec<Option<SoilPh>>>: FromSql<SqlTypeOf<soil_ph>, __DB>, Option<Vec<Option<SoilTextureEnum>>>: FromSql<SqlTypeOf<soil_texture>, __DB>, Option<DeciduousOrEvergreen>: FromSql<SqlTypeOf<deciduous_or_evergreen>, __DB>, Option<HerbaceousOrWoody>: FromSql<SqlTypeOf<herbaceous_or_woody>, __DB>, Option<Vec<Option<LifeCycle>>>: FromSql<SqlTypeOf<life_cycle>, __DB>, Option<Vec<Option<GrowthRate>>>: FromSql<SqlTypeOf<growth_rate>, __DB>, Option<i32>: FromSql<SqlTypeOf<height>, __DB> + FromSql<SqlTypeOf<spread>, __DB>, Option<Vec<Option<Fertility>>>: FromSql<SqlTypeOf<fertility>, __DB>, NaiveDateTime: FromSql<SqlTypeOf<created_at>, __DB> + FromSql<SqlTypeOf<updated_at>, __DB>, Option<bool>: FromSql<SqlTypeOf<has_drought_tolerance>, __DB> + FromSql<SqlTypeOf<tolerates_wind>, __DB> + FromSql<SqlTypeOf<edible>, __DB>, Option<Vec<Option<LightRequirement>>>: FromSql<SqlTypeOf<light_requirement>, __DB>, Option<Vec<Option<WaterRequirementEnum>>>: FromSql<SqlTypeOf<water_requirement>, __DB>, Option<Vec<Option<PropagationMethod>>>: FromSql<SqlTypeOf<propagation_method>, __DB>, Option<ExternalSource>: FromSql<SqlTypeOf<external_source>, __DB>, Option<Vec<Option<i16>>>: FromSql<SqlTypeOf<sowing_outdoors>, __DB> + FromSql<SqlTypeOf<harvest_time>, __DB>, Option<f64>: FromSql<SqlTypeOf<seed_weight_1000>, __DB>,

source§

fn build<'__a>(row: &impl NamedRow<'__a, __DB>) -> Result<Self>

Construct an instance of Self from the database row

Auto Trait Implementations§

§

impl Freeze for Plants

§

impl RefUnwindSafe for Plants

§

impl Send for Plants

§

impl Sync for Plants

§

impl Unpin for Plants

§

impl UnwindSafe for Plants

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<DB, T> FromSqlRow<Untyped, DB> for T
where DB: Backend, T: QueryableByName<DB>,

source§

fn build_from_row<'a>( row: &impl Row<'a, DB>, ) -> Result<T, Box<dyn Error + Sync + Send>>

See the trait documentation.
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, 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