toql_core/tree/tree_update.rs
1//! Trait to build UPDATE SQL statements.
2use crate::{error::ToqlError, query::field_path::FieldPath, sql_expr::SqlExpr};
3
4/// The trait allows to build the UPDATE SQL statement for nested structs.
5///
6/// Trait is implemented by the Toql derive for structs that can update.
7pub trait TreeUpdate {
8 fn update<'a, I>(
9 &self,
10 descendents: I,
11 fields: &std::collections::HashSet<String>, // if empty, all fields can be updated (*)
12 roles: &std::collections::HashSet<String>,
13 exprs: &mut Vec<SqlExpr>,
14 ) -> Result<(), ToqlError>
15 where
16 I: Iterator<Item = FieldPath<'a>> + Clone;
17}