20#include <ignite/client/detail/type_mapping_utils.h>
21#include <ignite/client/table/ignite_tuple.h>
22#include <ignite/client/transaction/transaction.h>
23#include <ignite/client/type_mapping.h>
25#include "ignite/common/detail/config.h"
26#include <ignite/common/ignite_result.h>
55 record_view(
const record_view &) =
delete;
56 record_view &operator=(
const record_view &) =
delete;
59 record_view() =
default;
60 record_view(record_view &&)
noexcept =
default;
61 record_view &operator=(record_view &&)
noexcept =
default;
73 transaction *tx,
const value_type &key, ignite_callback<std::optional<value_type>> callback);
83 [[nodiscard]] IGNITE_API std::optional<value_type>
get(
transaction *tx,
const value_type &key) {
84 return sync<std::optional<value_type>>(
85 [
this, tx, &key](
auto callback) {
get_async(tx, key, std::move(callback)); });
101 ignite_callback<std::vector<std::optional<value_type>>> callback);
114 [[nodiscard]] IGNITE_API std::vector<std::optional<value_type>>
get_all(
116 return sync<std::vector<std::optional<value_type>>>([
this, tx, keys = std::move(keys)](
auto callback)
mutable {
139 sync<void>([
this, tx, &record](
auto callback) {
upsert_async(tx, record, std::move(callback)); });
161 sync<void>([
this, tx, records = std::move(records)](
162 auto callback)
mutable {
upsert_all_async(tx, std::move(records), std::move(callback)); });
175 transaction *tx,
const value_type &record, ignite_callback<std::optional<value_type>> callback);
186 return sync<std::optional<value_type>>(
210 return sync<bool>([
this, tx, &record](
auto callback) {
insert_async(tx, record, std::move(callback)); });
223 transaction *tx, std::vector<value_type> records, ignite_callback<std::vector<value_type>> callback);
234 return sync<std::vector<value_type>>([
this, tx, records = std::move(records)](
auto callback)
mutable {
262 return sync<bool>([
this, tx, &record](
auto callback) {
replace_async(tx, record, std::move(callback)); });
277 transaction *tx,
const value_type &record,
const value_type &new_record, ignite_callback<bool> callback);
290 return sync<bool>([
this, tx, &record, &new_record](
291 auto callback) {
replace_async(tx, record, new_record, std::move(callback)); });
305 transaction *tx,
const value_type &record, ignite_callback<std::optional<value_type>> callback);
318 return sync<std::optional<value_type>>(
342 return sync<bool>([
this, tx, &record](
auto callback) {
remove_async(tx, record, std::move(callback)); });
368 return sync<bool>([
this, tx, &record](
auto callback) {
remove_exact_async(tx, record, std::move(callback)); });
381 transaction *tx,
const value_type &key, ignite_callback<std::optional<value_type>> callback);
392 return sync<std::optional<value_type>>(
407 transaction *tx, std::vector<value_type> keys, ignite_callback<std::vector<value_type>> callback);
419 return sync<std::vector<value_type>>([
this, tx, keys = std::move(keys)](
auto callback)
mutable {
435 transaction *tx, std::vector<value_type> records, ignite_callback<std::vector<value_type>> callback);
447 return sync<std::vector<value_type>>([
this, tx, records = std::move(records)](
auto callback)
mutable {
458 explicit record_view(std::shared_ptr<detail::table_impl> impl)
459 : m_impl(std::move(impl)) {}
462 std::shared_ptr<detail::table_impl> m_impl;
473 typedef typename std::decay<T>::type value_type;
476 record_view(
const record_view &) =
delete;
477 record_view &operator=(
const record_view &) =
delete;
480 record_view() =
default;
481 record_view(record_view &&)
noexcept =
default;
482 record_view &operator=(record_view &&)
noexcept =
default;
494 m_delegate.get_async(tx, convert_to_tuple(key),
495 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
506 [[nodiscard]] std::optional<value_type>
get(
transaction *tx,
const value_type &key) {
507 return sync<std::optional<value_type>>(
508 [
this, tx, &key](
auto callback) {
get_async(tx, key, std::move(callback)); });
524 ignite_callback<std::vector<std::optional<value_type>>> callback) {
525 m_delegate.get_all_async(tx, values_to_tuples<value_type>(std::move(keys)),
526 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
540 [[nodiscard]] std::vector<std::optional<value_type>>
get_all(
transaction *tx, std::vector<value_type> keys) {
541 return sync<std::vector<std::optional<value_type>>>([
this, tx, keys = std::move(keys)](
auto callback)
mutable {
555 m_delegate.upsert_async(tx, convert_to_tuple(record), std::move(callback));
566 sync<void>([
this, tx, &record](
auto callback) {
upsert_async(tx, record, std::move(callback)); });
579 m_delegate.upsert_all_async(tx, values_to_tuples<value_type>(std::move(records)), std::move(callback));
590 sync<void>([
this, tx, records = std::move(records)](
591 auto callback)
mutable {
upsert_all_async(tx, std::move(records), std::move(callback)); });
604 transaction *tx,
const value_type &record, ignite_callback<std::optional<value_type>> callback) {
605 m_delegate.get_and_upsert_async(tx, convert_to_tuple(record),
606 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
618 return sync<std::optional<value_type>>(
633 m_delegate.insert_async(tx, convert_to_tuple(record), std::move(callback));
644 return sync<bool>([
this, tx, &record](
auto callback) {
insert_async(tx, record, std::move(callback)); });
657 transaction *tx, std::vector<value_type> records, ignite_callback<std::vector<value_type>> callback) {
658 m_delegate.insert_all_async(tx, values_to_tuples<value_type>(std::move(records)),
659 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
671 return sync<std::vector<value_type>>([
this, tx, records = std::move(records)](
auto callback)
mutable {
687 m_delegate.replace_async(tx, convert_to_tuple(record), std::move(callback));
701 return sync<bool>([
this, tx, &record](
auto callback) {
replace_async(tx, record, std::move(callback)); });
716 transaction *tx,
const value_type &record,
const value_type &new_record, ignite_callback<bool> callback) {
717 m_delegate.replace_async(tx, convert_to_tuple(record), convert_to_tuple(new_record), std::move(callback));
731 return sync<bool>([
this, tx, &record, &new_record](
732 auto callback) {
replace_async(tx, record, new_record, std::move(callback)); });
746 transaction *tx,
const value_type &record, ignite_callback<std::optional<value_type>> callback) {
747 m_delegate.get_and_replace_async(tx, convert_to_tuple(record),
748 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
762 return sync<std::optional<value_type>>(
776 m_delegate.remove_async(tx, convert_to_tuple(key), std::move(callback));
788 return sync<bool>([
this, tx, &record](
auto callback) {
remove_async(tx, record, std::move(callback)); });
802 m_delegate.remove_exact_async(tx, convert_to_tuple(record), std::move(callback));
816 return sync<bool>([
this, tx, &record](
auto callback) {
remove_exact_async(tx, record, std::move(callback)); });
829 transaction *tx,
const value_type &key, ignite_callback<std::optional<value_type>> callback) {
830 m_delegate.get_and_remove_async(tx, convert_to_tuple(key),
831 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
843 return sync<std::optional<value_type>>(
858 transaction *tx, std::vector<value_type> keys, ignite_callback<std::vector<value_type>> callback) {
859 m_delegate.remove_all_async(tx, values_to_tuples<value_type>(std::move(keys)),
860 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
873 return sync<std::vector<value_type>>([
this, tx, keys = std::move(keys)](
auto callback)
mutable {
889 transaction *tx, std::vector<value_type> records, ignite_callback<std::vector<value_type>> callback) {
890 m_delegate.remove_all_exact_async(tx, values_to_tuples<value_type>(std::move(records)),
891 [callback = std::move(callback)](
auto res) { callback(convert_result<value_type>(std::move(res))); });
904 return sync<std::vector<value_type>>([
this, tx, records = std::move(records)](
auto callback)
mutable {
916 : m_delegate(std::move(delegate)) {}
919 record_view<ignite_tuple> m_delegate;
Definition ignite_tuple.h:40
IGNITE_API std::optional< value_type > get_and_remove(transaction *tx, const value_type &key)
Definition record_view.h:391
IGNITE_API std::vector< std::optional< value_type > > get_all(transaction *tx, std::vector< value_type > keys)
Definition record_view.h:114
IGNITE_API bool replace(transaction *tx, const value_type &record)
Definition record_view.h:261
IGNITE_API std::vector< value_type > insert_all(transaction *tx, std::vector< value_type > records)
Definition record_view.h:233
IGNITE_API void upsert(transaction *tx, const value_type &record)
Definition record_view.h:138
IGNITE_API std::vector< value_type > remove_all_exact(transaction *tx, std::vector< value_type > records)
Definition record_view.h:446
IGNITE_API std::optional< value_type > get_and_replace(transaction *tx, const value_type &record)
Definition record_view.h:317
IGNITE_API bool replace(transaction *tx, const value_type &record, const value_type &new_record)
Definition record_view.h:289
IGNITE_API bool insert(transaction *tx, const value_type &record)
Definition record_view.h:209
IGNITE_API bool remove(transaction *tx, const value_type &record)
Definition record_view.h:341
IGNITE_API bool remove_exact(transaction *tx, const value_type &record)
Definition record_view.h:367
IGNITE_API std::vector< value_type > remove_all(transaction *tx, std::vector< value_type > keys)
Definition record_view.h:418
IGNITE_API std::optional< value_type > get_and_upsert(transaction *tx, const value_type &record)
Definition record_view.h:185
IGNITE_API void upsert_all(transaction *tx, std::vector< value_type > records)
Definition record_view.h:160
IGNITE_API std::optional< value_type > get(transaction *tx, const value_type &key)
Definition record_view.h:83
Definition record_view.h:469
std::vector< value_type > remove_all(transaction *tx, std::vector< value_type > keys)
Definition record_view.h:872
void get_and_replace_async(transaction *tx, const value_type &record, ignite_callback< std::optional< value_type > > callback)
Definition record_view.h:745
std::vector< value_type > remove_all_exact(transaction *tx, std::vector< value_type > records)
Definition record_view.h:903
void remove_all_async(transaction *tx, std::vector< value_type > keys, ignite_callback< std::vector< value_type > > callback)
Definition record_view.h:857
void replace_async(transaction *tx, const value_type &record, ignite_callback< bool > callback)
Definition record_view.h:686
std::vector< value_type > insert_all(transaction *tx, std::vector< value_type > records)
Definition record_view.h:670
bool replace(transaction *tx, const value_type &record)
Definition record_view.h:700
std::optional< value_type > get_and_replace(transaction *tx, const value_type &record)
Definition record_view.h:761
void remove_all_exact_async(transaction *tx, std::vector< value_type > records, ignite_callback< std::vector< value_type > > callback)
Definition record_view.h:888
void get_and_remove_async(transaction *tx, const value_type &key, ignite_callback< std::optional< value_type > > callback)
Definition record_view.h:828
bool insert(transaction *tx, const value_type &record)
Definition record_view.h:643
void upsert_all(transaction *tx, std::vector< value_type > records)
Definition record_view.h:589
void get_async(transaction *tx, const value_type &key, ignite_callback< std::optional< value_type > > callback)
Definition record_view.h:493
void replace_async(transaction *tx, const value_type &record, const value_type &new_record, ignite_callback< bool > callback)
Definition record_view.h:715
bool replace(transaction *tx, const value_type &record, const value_type &new_record)
Definition record_view.h:730
std::vector< std::optional< value_type > > get_all(transaction *tx, std::vector< value_type > keys)
Definition record_view.h:540
bool remove(transaction *tx, const value_type &record)
Definition record_view.h:787
std::optional< value_type > get(transaction *tx, const value_type &key)
Definition record_view.h:506
void upsert_async(transaction *tx, const value_type &record, ignite_callback< void > callback)
Definition record_view.h:554
void upsert_all_async(transaction *tx, std::vector< value_type > records, ignite_callback< void > callback)
Definition record_view.h:578
void get_and_upsert_async(transaction *tx, const value_type &record, ignite_callback< std::optional< value_type > > callback)
Definition record_view.h:603
void get_all_async(transaction *tx, std::vector< value_type > keys, ignite_callback< std::vector< std::optional< value_type > > > callback)
Definition record_view.h:523
void upsert(transaction *tx, const value_type &record)
Definition record_view.h:565
std::optional< value_type > get_and_remove(transaction *tx, const value_type &key)
Definition record_view.h:842
bool remove_exact(transaction *tx, const value_type &record)
Definition record_view.h:815
void remove_exact_async(transaction *tx, const value_type &record, ignite_callback< bool > callback)
Definition record_view.h:801
void insert_all_async(transaction *tx, std::vector< value_type > records, ignite_callback< std::vector< value_type > > callback)
Definition record_view.h:656
void insert_async(transaction *tx, const value_type &record, ignite_callback< bool > callback)
Definition record_view.h:632
void remove_async(transaction *tx, const value_type &key, ignite_callback< bool > callback)
Definition record_view.h:775
std::optional< value_type > get_and_upsert(transaction *tx, const value_type &record)
Definition record_view.h:617
Definition transaction.h:35