Files
scylladb/cql3/functions/uuid_fcts.hh
Avi Kivity 3e0aacc8b5 db, cql3: functions: pass function parameters as a span instead of a vector
Spans are more flexible and can be constructed from any contiguous
container (such as small_vector), or a subrange of such a container.
This can save allocations, so change the signature to accept a span.

Spans cannot be constructed from std::initializer_list, so one such
call site is changed to use construct a span directly from the single
argument.
2023-04-19 20:38:55 +03:00

32 lines
555 B
C++

/*
* Modified by ScyllaDB
*
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "types/types.hh"
#include "native_scalar_function.hh"
#include "utils/UUID.hh"
namespace cql3 {
namespace functions {
inline
shared_ptr<function>
make_uuid_fct() {
return make_native_scalar_function<false>("uuid", uuid_type, {},
[] (std::span<const bytes_opt> parameters) -> bytes_opt {
return {uuid_type->decompose(utils::make_random_uuid())};
});
}
}
}