36 static constexpr auto kDELETER = [](CassCollection* ptr) { cass_collection_free(ptr); };
39 throwErrorIfNeeded(CassError
const rc, std::string_view
const label)
43 auto const tag =
'[' + std::string{label} +
']';
44 throw std::logic_error(tag +
": " + cass_error_desc(rc));
50 template <
typename Type>
51 explicit Collection(std::vector<Type>
const& value)
52 :
ManagedObject{cass_collection_new(CASS_COLLECTION_TYPE_LIST, value.size()), kDELETER}
57 template <
typename Type>
59 bind(std::vector<Type>
const& values)
const
61 for (
auto const& value : values)
66 append(
bool const value)
const
68 auto const rc = cass_collection_append_bool(*
this, value ? cass_true : cass_false);
69 throwErrorIfNeeded(rc,
"Bind bool");
73 append(int64_t
const value)
const
75 auto const rc = cass_collection_append_int64(*
this, value);
76 throwErrorIfNeeded(rc,
"Bind int64");
80 append(ripple::uint256
const& value)
const
82 auto const rc = cass_collection_append_bytes(
84 static_cast<cass_byte_t const*
>(
static_cast<unsigned char const*
>(value.data())),
85 ripple::uint256::size()
87 throwErrorIfNeeded(rc,
"Bind ripple::uint256");