16class Collection :
public ManagedObject<CassCollection> {
17 static constexpr auto kDELETER = [](CassCollection* ptr) { cass_collection_free(ptr); };
20 throwErrorIfNeeded(CassError
const rc, std::string_view
const label)
24 auto const tag =
'[' + std::string{label} +
']';
25 throw std::logic_error(tag +
": " + cass_error_desc(rc));
29 Collection(CassCollection* ptr);
31 template <
typename Type>
32 explicit Collection(std::vector<Type>
const& value)
33 : ManagedObject{cass_collection_new(CASS_COLLECTION_TYPE_LIST, value.size()), kDELETER}
38 template <
typename Type>
40 bind(std::vector<Type>
const& values)
const
42 for (
auto const& value : values)
47 append(
bool const value)
const
49 auto const rc = cass_collection_append_bool(*
this, value ? cass_true : cass_false);
50 throwErrorIfNeeded(rc,
"Bind bool");
54 append(int64_t
const value)
const
56 auto const rc = cass_collection_append_int64(*
this, value);
57 throwErrorIfNeeded(rc,
"Bind int64");
61 append(ripple::uint256
const& value)
const
63 auto const rc = cass_collection_append_bytes(
65 static_cast<cass_byte_t const*
>(
static_cast<unsigned char const*
>(value.data())),
66 ripple::uint256::size()
68 throwErrorIfNeeded(rc,
"Bind ripple::uint256");