pub struct ForEachNode {
pub childs: Vec<NodeType>,
pub collection: String,
pub index: String,
pub item: String,
}
Expand description
Represents a for
loop node in py_sql.
It iterates over a collection and executes the nested SQL block for each item.
§Attributes
collection
: The expression providing the collection to iterate over.item
: The name of the variable to hold the current item in each iteration.index
: The name of the variable to hold the current key/index in each iteration.
§Example
PySQL syntax:
for item in ids:
AND id = #{item}
for key, item in user_map:
(#{key}, #{item.name})
Fields§
§childs: Vec<NodeType>
§collection: String
§index: String
§item: String
Trait Implementations§
Source§impl Clone for ForEachNode
impl Clone for ForEachNode
Source§fn clone(&self) -> ForEachNode
fn clone(&self) -> ForEachNode
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ForEachNode
impl Debug for ForEachNode
Source§impl PartialEq for ForEachNode
impl PartialEq for ForEachNode
impl Eq for ForEachNode
impl StructuralPartialEq for ForEachNode
Auto Trait Implementations§
impl Freeze for ForEachNode
impl RefUnwindSafe for ForEachNode
impl Send for ForEachNode
impl Sync for ForEachNode
impl Unpin for ForEachNode
impl UnwindSafe for ForEachNode
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.