QueryNode

Struct QueryNode 

Source
pub struct QueryNode {
Show 13 fields pub id: String, pub table: String, pub relationship_type: Option<RelationshipType>, pub relationship_metadata: Option<RelationshipMetadata>, pub parent_id: Option<String>, pub children: Vec<String>, pub depth: usize, pub estimated_rows: usize, pub parallel_safe: bool, pub foreign_key: Option<String>, pub constraints: Vec<String>, pub available_columns: Vec<String>, pub index_hints: Vec<String>,
}
Expand description

Represents a node in the query execution plan

Fields§

§id: String

Unique identifier for this node

§table: String

Table to query

§relationship_type: Option<RelationshipType>

Type of relationship from parent

§relationship_metadata: Option<RelationshipMetadata>

Full relationship metadata if available

§parent_id: Option<String>

Parent node ID (None for root)

§children: Vec<String>

Child node IDs

§depth: usize

Depth in the relationship tree

§estimated_rows: usize

Estimated row count (can be updated from metadata)

§parallel_safe: bool

Whether this node can be executed in parallel with siblings

§foreign_key: Option<String>

Foreign key used to join with parent

§constraints: Vec<String>

Additional constraints for optimization

§available_columns: Vec<String>

Column names available in this table (for better query construction)

§index_hints: Vec<String>

Index hints for the optimizer

Implementations§

Source§

impl QueryNode

Source

pub fn new(id: String, table: String) -> Self

Create a new query node

Source

pub fn root(id: String, table: String) -> Self

Create a root node (no parent)

Source

pub fn child( id: String, table: String, parent_id: String, relationship_type: RelationshipType, foreign_key: String, ) -> Self

Create a child node with parent relationship

Source

pub fn child_with_metadata( id: String, table: String, parent_id: String, metadata: RelationshipMetadata, ) -> Self

Create a child node with full relationship metadata

Source

pub fn add_child(&mut self, child_id: String)

Add a child node ID

Source

pub fn set_depth(&mut self, depth: usize)

Set the depth for this node

Source

pub fn set_estimated_rows(&mut self, rows: usize)

Set row count estimate

Source

pub fn set_parallel_safe(&mut self, safe: bool)

Set parallel safety

Source

pub fn add_constraint(&mut self, constraint: String)

Add a constraint

Source

pub fn is_root(&self) -> bool

Check if this node is a root node

Source

pub fn is_leaf(&self) -> bool

Check if this node is a leaf node

Source

pub fn set_metadata(&mut self, metadata: RelationshipMetadata)

Update metadata for this node

Source

pub fn set_columns(&mut self, columns: Vec<String>)

Set column information for better query construction

Source

pub fn add_index_hint(&mut self, index: String)

Add index hints for optimization

Source

pub fn primary_key(&self) -> &str

Get the primary key column name (defaults to “id”)

Source

pub fn get_foreign_key(&self) -> Option<&str>

Get the foreign key column name for relationships

Source

pub fn is_collection(&self) -> bool

Check if this node represents a collection relationship

Source

pub fn requires_pivot(&self) -> bool

Check if this node requires a pivot table

Trait Implementations§

Source§

impl Clone for QueryNode

Source§

fn clone(&self) -> QueryNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryNode

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,