pub struct TrackedExpressionAttributes<'a> {
pub names: &'a Option<HashMap<String, String>>,
pub values: &'a Option<HashMap<String, AttributeValue>>,
/* private fields */
}Expand description
Wrapper around expression attribute names/values that tracks which entries are used.
Use RefCell for interior mutability so it can be passed as &TrackedExpressionAttributes
(not &mut) through all expression evaluation functions.
Fields§
§names: &'a Option<HashMap<String, String>>§values: &'a Option<HashMap<String, AttributeValue>>Implementations§
Source§impl<'a> TrackedExpressionAttributes<'a>
impl<'a> TrackedExpressionAttributes<'a>
pub fn new( names: &'a Option<HashMap<String, String>>, values: &'a Option<HashMap<String, AttributeValue>>, ) -> Self
Sourcepub fn without_tracking(
names: &'a Option<HashMap<String, String>>,
values: &'a Option<HashMap<String, AttributeValue>>,
) -> Self
pub fn without_tracking( names: &'a Option<HashMap<String, String>>, values: &'a Option<HashMap<String, AttributeValue>>, ) -> Self
Create a variant that skips tracking. Name/value resolution still works
but HashSet insertions are skipped. Use in hot loops where tracking has
already been done by track_condition_expr pre-loop.
Sourcepub fn resolve_name(&self, name: &str) -> Result<String, String>
pub fn resolve_name(&self, name: &str) -> Result<String, String>
Resolve an attribute name, handling #name substitution, and track usage.
Sourcepub fn resolve_value<'b>(
&'b self,
name: &str,
) -> Result<&'a AttributeValue, String>
pub fn resolve_value<'b>( &'b self, name: &str, ) -> Result<&'a AttributeValue, String>
Resolve an attribute value reference :name and track usage.
Sourcepub fn track_condition_expr(&self, expr: &ConditionExpr)
pub fn track_condition_expr(&self, expr: &ConditionExpr)
Pre-register all #name and :value references found in a parsed condition expression.
This ensures they are tracked even if the expression is never evaluated (e.g., no items).
Sourcepub fn track_projection_expr(&self, proj: &ProjectionExpr)
pub fn track_projection_expr(&self, proj: &ProjectionExpr)
Pre-register all #name references found in a parsed projection expression.
Sourcepub fn track_update_expr(&self, expr: &UpdateExpr)
pub fn track_update_expr(&self, expr: &UpdateExpr)
Pre-register all #name and :value references found in a parsed update expression.
Sourcepub fn track_key_condition(&self, cond: &KeyCondition)
pub fn track_key_condition(&self, cond: &KeyCondition)
Pre-register all #name and :value references in a parsed key condition.
Note: key_condition::parse already resolves names, so we track the original
value refs that will be resolved later via resolve_values.
Sourcepub fn check_unused(&self) -> Result<(), DynoxideError>
pub fn check_unused(&self) -> Result<(), DynoxideError>
Check for unused names/values. Returns an error listing all unused keys.