Files
scylladb/cql3/expr/unset.hh
Avi Kivity 0ae22a09d4 LICENSE: Update to version 1.1
Updated terms of non-commercial use (must be a never-customer).
2026-04-12 19:46:33 +03:00

31 lines
867 B
C++

// Copyright (C) 2023-present ScyllaDB
// SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.1 and Apache-2.0)
#pragma once
#include <optional>
#include "expression.hh"
namespace cql3 {
class query_options;
}
namespace cql3::expr {
// Some expression users can behave differently if the expression is a bind variable
// and if that bind variable is unset. unset_bind_variable_guard encapsulates the two
// conditions.
class unset_bind_variable_guard {
// Disengaged if the operand is not exactly a single bind variable.
std::optional<bind_variable> _var;
public:
explicit unset_bind_variable_guard(const expr::expression& operand);
explicit unset_bind_variable_guard(std::nullopt_t) {}
explicit unset_bind_variable_guard(const std::optional<expr::expression>& operand);
bool is_unset(const query_options& qo) const;
};
}