use crate::AttributeValue;
#[derive(Debug)]
pub(crate) struct AttributeEntry<'a> {
pub(crate) set: bool,
pub(crate) key: &'a str,
pub(crate) value: AttributeValue,
}
impl<'a> AttributeEntry<'a> {
pub(crate) fn new(key: &'a str, set: bool, value_opt: Option<&str>) -> Self {
let value = if !set {
AttributeValue::Bool(false)
} else if let Some(v) = value_opt {
match v.trim() {
"true" => AttributeValue::Bool(true),
"false" => AttributeValue::Bool(false),
_ => AttributeValue::String(v.to_string()),
}
} else {
AttributeValue::Bool(true)
};
Self { set, key, value }
}
}