dynamodb_expression/condition/between.rs
1use core::fmt;
2
3use crate::operand::Operand;
4
5/// Represents the [DynamoDB `BETWEEN` operator][1].
6///
7/// See also: [`Path::between`], [`Key::between`]
8///
9/// [1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
10/// [`Path::between`]: crate::path::Path::between
11/// [`Key::between`]: crate::key::Key::between
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct Between {
14 pub(crate) op: Operand,
15
16 /// Equal to or greater than this value
17 pub(crate) lower: Operand,
18
19 /// Equal to or less than this value
20 pub(crate) upper: Operand,
21}
22
23impl fmt::Display for Between {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 self.op.fmt(f)?;
26 f.write_str(" BETWEEN ")?;
27 self.lower.fmt(f)?;
28 f.write_str(" AND ")?;
29 self.upper.fmt(f)
30 }
31}