dynamodb_expression/condition/
attribute_not_exists.rs

1use core::fmt::{self, Write};
2
3use crate::path::Path;
4
5/// The [DynamoDB `attribute_not_exists` function][1]. True if the item does not
6/// contain the attribute in a specified [`Path`].
7///
8/// See also: [`Path::attribute_not_exists`]
9///
10/// [1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
11#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
12pub struct AttributeNotExists {
13    // `Path` is correct here
14    // https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Syntax
15    pub(crate) path: Path,
16}
17
18impl fmt::Display for AttributeNotExists {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        f.write_str("attribute_not_exists(")?;
21        self.path.fmt(f)?;
22        f.write_char(')')
23    }
24}
25
26impl<T> From<T> for AttributeNotExists
27where
28    T: Into<Path>,
29{
30    fn from(name: T) -> Self {
31        Self { path: name.into() }
32    }
33}