Skip to main content

DefaultConventions

Struct DefaultConventions 

Source
pub struct DefaultConventions;
Expand description

This project’s conventions.

Filters names its types after the struct’s pascal-case segments, the last one being the layer’s suffix (OrderModel → OrdersQueryModel, OrderSortFieldModel, …; OrderDto → OrdersQueryParams, …), so the struct’s name needs at least two segments, as does a model deriving MergePatch. A merge patch struct is named MergePatch… (MergePatchOrderModel), and a wrapper is pascal cased.

The runtime crates keep their default, absolute paths (::queryweave, …).

A sort variant is its field pascal cased (delivery_date → DeliveryDate), and a filter field is its field followed by the operator (username_sw), except bool, which keeps the bare field (is_active).

Trait Implementations§

Source§

impl Conventions for DefaultConventions

Source§

fn filters_names(input: &Ident) -> Result<FiltersNames>

The names of the types #[derive(Filters)] generates for input. Read more
Source§

fn check_model_name(name: &Ident) -> Result<()>

Check the name of a model deriving MergePatch. Read more
Source§

fn check_merge_patch_name<S: ToTokens + ?Sized>( name: &Ident, span: &S, what: &str, ) -> Result<()>

Check the name of a merge patch struct: the struct a derive is placed on (MergePatchNullableFields, ValidateNonNullable), or one an attribute links to (#[merge_patch(patch = path)], or #[validate_non_nullable(mirrors = path)]), calling it what. Read more
Source§

fn sort_variant(field: &Ident, span: Span) -> Ident

The variant of the generated sortable-fields enum for the #[sortable] field field, spanned to span. Read more
Source§

fn filter_field(field: &Ident, operator: &str, span: Span) -> Ident

The generated filter field (and, on a DTO, query parameter) filtering field with the operator written operator in #[filter(...)] (lt, eq, gt, sw, c, ew or bool), spanned to span. Read more
Source§

fn check_wrapper_name<S: ToTokens + ?Sized>( name: &Ident, span: &S, what: &str, ) -> Result<()>

Check the name of a wrapper an attribute links to (#[append_to_query(filters = path)] of AppendToQuery), calling it what. Read more
Source§

fn core_crate() -> Path

The path of the core runtime crate, named by the code generated for a root model (Filters, MergePatch, MergePatchNullableFields, RawValue). Read more
Source§

fn api_crate() -> Path

The path of the API runtime crate, named by the code generated for an API type (a Filters mirror with serde or utoipa, ValidateNonNullable). Defaults to ::queryweave_api.
Source§

fn sql_crate() -> Path

The path of the SQL runtime crate, named by the code generated for the persistence layer (Columns, AppendToQuery, AppendConditions). Defaults to ::queryweave_sql.
Source§

fn integrations() -> Vec<&'static dyn Integration>

The integrations a Filters mirror may opt into, each with the flag of #[filters(...)] named after it, in the order their additions are generated. Their names must differ from each other and from mirrors. Read more

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.