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/
69 lines
2.4 KiB
C++
69 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 and Apache-2.0)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "operation.hh"
|
|
#include "update_parameters.hh"
|
|
|
|
namespace cql3 {
|
|
|
|
/**
|
|
* Static helper methods and classes for maps.
|
|
*/
|
|
class maps {
|
|
private:
|
|
maps() = delete;
|
|
public:
|
|
static lw_shared_ptr<column_specification> key_spec_of(const column_specification& column);
|
|
static lw_shared_ptr<column_specification> value_spec_of(const column_specification& column);
|
|
|
|
class setter : public operation_skip_if_unset {
|
|
public:
|
|
setter(const column_definition& column, expr::expression e)
|
|
: operation_skip_if_unset(column, std::move(e)) {
|
|
}
|
|
|
|
virtual void execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params) override;
|
|
static void execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params, const column_definition& column, const cql3::raw_value& value);
|
|
};
|
|
|
|
class setter_by_key : public operation_skip_if_unset {
|
|
expr::expression _k;
|
|
public:
|
|
setter_by_key(const column_definition& column, expr::expression k, expr::expression e)
|
|
: operation_skip_if_unset(column, std::move(e)), _k(std::move(k)) {
|
|
}
|
|
virtual void fill_prepare_context(prepare_context& ctx) override;
|
|
virtual void execute(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params) override;
|
|
};
|
|
|
|
class putter : public operation_skip_if_unset {
|
|
public:
|
|
putter(const column_definition& column, expr::expression e)
|
|
: operation_skip_if_unset(column, std::move(e)) {
|
|
}
|
|
virtual void execute(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params) override;
|
|
};
|
|
|
|
static void do_put(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params,
|
|
const cql3::raw_value& value, const column_definition& column);
|
|
|
|
class discarder_by_key : public operation_no_unset_support {
|
|
public:
|
|
discarder_by_key(const column_definition& column, expr::expression k)
|
|
: operation_no_unset_support(column, std::move(k)) {
|
|
}
|
|
virtual void execute(mutation& m, const clustering_key_prefix& prefix, const update_parameters& params) override;
|
|
};
|
|
};
|
|
|
|
}
|