Files
scylladb/cql3/expr/unset.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

31 lines
867 B
C++

// Copyright (C) 2023-present ScyllaDB
// SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 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;
};
}