Skip to main content

RelationalQuery

Struct RelationalQuery 

Source
pub struct RelationalQuery<T> { /* private fields */ }
Expand description

Relational query with result shape in T (tuple that grows with each relation).

Implementations§

Source§

impl<T> RelationalQuery<T>

Source

pub fn inner_builder(&self) -> &RelationalSelectBuilder

Inner SQL builder.

Source

pub fn to_sql_postgres(&self) -> String

Postgres SQL.

Source

pub fn to_sql_sqlite(&self) -> String

SQLite SQL.

Source

pub fn to_sql(&self) -> String

Active dialect SQL.

Source

pub fn parse_many_column(json: &str) -> Result<Vec<Vec<Value>>, DbCoreError>

Parse a has-many JSON column (json_agg / json_group_array shape).

§Errors

Forwards toolu_orm_core::relational_row::parse_json_array_of_arrays errors.

Source

pub fn parse_one_column(json: &str) -> Result<Vec<Value>, DbCoreError>

Parse a has-one / belongs-to JSON column (json_build_array / null).

§Errors

Forwards toolu_orm_core::relational_row::parse_json_single_array errors.

Source§

impl<Base> RelationalQuery<(Base,)>

Source

pub fn new(table: &str, columns: &[&str]) -> Self

Start a query; base row type is wrapped in a 1-tuple.

Source§

impl<T> RelationalQuery<T>

Source

pub fn with_many<R>( self, field_name: &str, target_table: &str, local_key: &str, foreign_key_on_target: &str, target_columns: &[&str], ) -> RelationalQuery<<T as TupleAppend<Vec<R>>>::Output>
where T: TupleAppend<Vec<R>>,

Add has-many; appends Vec<R>.

Source

pub fn with_one<R>( self, field_name: &str, target_table: &str, local_key: &str, foreign_key_on_target: &str, target_columns: &[&str], ) -> RelationalQuery<<T as TupleAppend<Option<R>>>::Output>
where T: TupleAppend<Option<R>>,

Add belongs-to / has-one; appends Option<R>.

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

Source§

type Output = T

Should always be Self
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.