couchbase 4.2.3 → 4.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +54 -4
- package/deps/couchbase-cxx-client/README.md +1 -0
- package/deps/couchbase-cxx-client/bin/create-search-index +164 -0
- package/deps/couchbase-cxx-client/bin/init-cluster +55 -10
- package/deps/couchbase-cxx-client/bin/run-unit-tests +62 -6
- package/deps/couchbase-cxx-client/bin/travel-sample-index-v6.json +184 -0
- package/deps/couchbase-cxx-client/bin/travel-sample-index.json +188 -0
- package/deps/couchbase-cxx-client/cmake/Documentation.cmake +0 -1
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +98 -3
- package/deps/couchbase-cxx-client/cmake/Testing.cmake +8 -0
- package/deps/couchbase-cxx-client/cmake/build_config.hxx.in +3 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +183 -152
- package/deps/couchbase-cxx-client/core/bucket.hxx +17 -4
- package/deps/couchbase-cxx-client/core/cluster.hxx +18 -1
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +1 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +2 -1
- package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +10 -12
- package/deps/couchbase-cxx-client/core/error_context/search.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +62 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +51 -0
- package/deps/couchbase-cxx-client/core/impl/date_range.cxx +89 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +54 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +125 -0
- package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +51 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +141 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +61 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +60 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +41 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +84 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +82 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +32 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +137 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +45 -0
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +98 -0
- package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +35 -0
- package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +35 -0
- package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/match_query.cxx +59 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +49 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +54 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +75 -0
- package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +37 -0
- package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/search.cxx +191 -0
- package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +147 -0
- package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/search_result.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/search_row.cxx +74 -0
- package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +104 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +36 -0
- package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/term_query.cxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +57 -0
- package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +9 -2
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +54 -37
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +4 -3
- package/deps/couchbase-cxx-client/core/json_string.hxx +5 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +18 -4
- package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +39 -0
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -1
- package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +11 -2
- package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +1 -0
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +59 -46
- package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +77 -0
- package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +223 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +39 -0
- package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +88 -0
- package/deps/couchbase-cxx-client/couchbase/date_range.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +56 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +265 -0
- package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +111 -0
- package/deps/couchbase-cxx-client/couchbase/error_context.hxx +17 -8
- package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
- package/deps/couchbase-cxx-client/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
- package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +49 -0
- package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +107 -0
- package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +32 -0
- package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +45 -0
- package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +7 -2
- package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +45 -0
- package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +108 -0
- package/deps/couchbase-cxx-client/couchbase/match_query.hxx +163 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +56 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +143 -0
- package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +82 -0
- package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +82 -0
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +39 -0
- package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +68 -0
- package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +138 -0
- package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +50 -0
- package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +127 -0
- package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +509 -0
- package/deps/couchbase-cxx-client/couchbase/search_query.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/search_result.hxx +77 -0
- package/deps/couchbase-cxx-client/couchbase/search_row.hxx +104 -0
- package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +86 -0
- package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +34 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +117 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +27 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +28 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +51 -0
- package/deps/couchbase-cxx-client/couchbase/security_options.hxx +3 -0
- package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +4 -2
- package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +48 -0
- package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/term_query.hxx +151 -0
- package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +142 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/transactions.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +83 -0
- package/deps/couchbase-cxx-client/docs/Doxyfile.in +1 -1
- package/deps/couchbase-cxx-client/docs/cbc-analytics.md +2 -2
- package/deps/couchbase-cxx-client/docs/cbc-get.md +3 -2
- package/deps/couchbase-cxx-client/docs/cbc-pillowfight.md +7 -2
- package/deps/couchbase-cxx-client/docs/cbc-query.md +2 -2
- package/deps/couchbase-cxx-client/docs/cbc.md +3 -3
- package/deps/couchbase-cxx-client/docs/cli.hxx +5 -5
- package/deps/couchbase-cxx-client/docs/mainpage.hxx +42 -5
- package/deps/couchbase-cxx-client/test/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/test/test_integration_analytics.cxx +28 -6
- package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +7 -3
- package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +7 -3
- package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +13 -3
- package/deps/couchbase-cxx-client/test/test_integration_diagnostics.cxx +8 -2
- package/deps/couchbase-cxx-client/test/test_integration_durability.cxx +12 -7
- package/deps/couchbase-cxx-client/test/test_integration_examples.cxx +283 -11
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +140 -88
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +67 -9
- package/deps/couchbase-cxx-client/test/test_integration_range_scan.cxx +12 -12
- package/deps/couchbase-cxx-client/test/test_integration_read_replica.cxx +48 -11
- package/deps/couchbase-cxx-client/test/test_integration_search.cxx +19 -1
- package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +60 -9
- package/deps/couchbase-cxx-client/test/test_integration_tracer.cxx +3 -0
- package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +4 -0
- package/deps/couchbase-cxx-client/test/test_transaction_examples.cxx +100 -85
- package/deps/couchbase-cxx-client/test/test_unit_connection_string.cxx +29 -0
- package/deps/couchbase-cxx-client/test/test_unit_search.cxx +427 -0
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -1
- package/deps/couchbase-cxx-client/test/utils/logger.cxx +3 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.hxx +31 -15
- package/deps/couchbase-cxx-client/test/utils/test_context.cxx +8 -0
- package/deps/couchbase-cxx-client/tools/get.cxx +9 -8
- package/deps/couchbase-cxx-client/tools/pillowfight.cxx +175 -75
- package/deps/couchbase-cxx-client/tools/version.cxx +4 -2
- package/dist/binding.d.ts +1 -1
- package/package.json +1 -1
- package/src/jstocbpp_autogen.hpp +3 -2
@@ -0,0 +1,427 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-2021 Couchbase, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#include "test_helper.hxx"
|
19
|
+
|
20
|
+
#include "core/impl/encoded_search_query.hxx"
|
21
|
+
|
22
|
+
#include <couchbase/boolean_field_query.hxx>
|
23
|
+
#include <couchbase/boolean_query.hxx>
|
24
|
+
#include <couchbase/conjunction_query.hxx>
|
25
|
+
#include <couchbase/date_range_query.hxx>
|
26
|
+
#include <couchbase/disjunction_query.hxx>
|
27
|
+
#include <couchbase/geo_bounding_box_query.hxx>
|
28
|
+
#include <couchbase/geo_distance_query.hxx>
|
29
|
+
#include <couchbase/geo_polygon_query.hxx>
|
30
|
+
#include <couchbase/match_phrase_query.hxx>
|
31
|
+
#include <couchbase/match_query.hxx>
|
32
|
+
#include <couchbase/numeric_range_query.hxx>
|
33
|
+
#include <couchbase/phrase_query.hxx>
|
34
|
+
#include <couchbase/prefix_query.hxx>
|
35
|
+
#include <couchbase/query_string_query.hxx>
|
36
|
+
#include <couchbase/regexp_query.hxx>
|
37
|
+
#include <couchbase/term_query.hxx>
|
38
|
+
#include <couchbase/term_range_query.hxx>
|
39
|
+
#include <couchbase/wildcard_query.hxx>
|
40
|
+
|
41
|
+
#include <tao/json.hpp>
|
42
|
+
|
43
|
+
using namespace tao::json::literals;
|
44
|
+
|
45
|
+
TEST_CASE("unit: query string search query", "[unit]")
|
46
|
+
{
|
47
|
+
{
|
48
|
+
// clang-format off
|
49
|
+
//! [search-query-string-boosting]
|
50
|
+
couchbase::query_string_query query(R"(description:pool name:pool^5)");
|
51
|
+
//! [search-query-string-boosting]
|
52
|
+
// clang-format on
|
53
|
+
const auto encoded = query.encode();
|
54
|
+
REQUIRE_FALSE(encoded.ec);
|
55
|
+
REQUIRE(encoded.query == "{\"query\":\"description:pool name:pool^5\"}"_json);
|
56
|
+
}
|
57
|
+
{
|
58
|
+
// clang-format off
|
59
|
+
//! [search-query-string-date-range]
|
60
|
+
couchbase::query_string_query query(R"(created:>"2016-09-21")");
|
61
|
+
//! [search-query-string-date-range]
|
62
|
+
// clang-format on
|
63
|
+
const auto encoded = query.encode();
|
64
|
+
REQUIRE_FALSE(encoded.ec);
|
65
|
+
REQUIRE(encoded.query == "{\"query\":\"created:>\\\"2016-09-21\\\"\"}"_json);
|
66
|
+
}
|
67
|
+
|
68
|
+
{
|
69
|
+
// clang-format off
|
70
|
+
//! [search-query-string-numeric-range]
|
71
|
+
couchbase::query_string_query query(R"(reviews.ratings.Cleanliness:>4)");
|
72
|
+
//! [search-query-string-numeric-range]
|
73
|
+
// clang-format on
|
74
|
+
query.boost(1.42);
|
75
|
+
const auto encoded = query.encode();
|
76
|
+
REQUIRE_FALSE(encoded.ec);
|
77
|
+
REQUIRE(encoded.query == "{\"boost\":1.42,\"query\":\"reviews.ratings.Cleanliness:>4\"}"_json);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
TEST_CASE("unit: match search query", "[unit]")
|
82
|
+
{
|
83
|
+
{
|
84
|
+
// clang-format off
|
85
|
+
//! [search-match]
|
86
|
+
auto query = couchbase::match_query("location hostel")
|
87
|
+
.field("reviews.content")
|
88
|
+
.analyzer("standard")
|
89
|
+
.fuzziness(2)
|
90
|
+
.prefix_length(4)
|
91
|
+
.match_operator(couchbase::match_operator::logical_and);
|
92
|
+
//! [search-match]
|
93
|
+
// clang-format on
|
94
|
+
const auto encoded = query.encode();
|
95
|
+
REQUIRE_FALSE(encoded.ec);
|
96
|
+
REQUIRE(encoded.query == R"(
|
97
|
+
{"analyzer":"standard","field":"reviews.content","fuzziness":2,"match":"location hostel","operator":"and","prefix_length":4}
|
98
|
+
)"_json);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
TEST_CASE("unit: conjunction search query", "[unit]")
|
103
|
+
{
|
104
|
+
// clang-format off
|
105
|
+
//! [search-conjunction]
|
106
|
+
auto query = couchbase::conjunction_query{
|
107
|
+
couchbase::match_query("location hostel").field("reviews.content"),
|
108
|
+
couchbase::boolean_field_query(true).field("free_breakfast")
|
109
|
+
};
|
110
|
+
//! [search-conjunction]
|
111
|
+
// clang-format on
|
112
|
+
const auto encoded = query.encode();
|
113
|
+
REQUIRE_FALSE(encoded.ec);
|
114
|
+
REQUIRE(encoded.query == R"(
|
115
|
+
{"conjuncts":[
|
116
|
+
{"field":"reviews.content","match":"location hostel"},
|
117
|
+
{"bool":true,"field":"free_breakfast"}
|
118
|
+
]}
|
119
|
+
)"_json);
|
120
|
+
}
|
121
|
+
|
122
|
+
TEST_CASE("unit: disjunction search query", "[unit]")
|
123
|
+
{
|
124
|
+
// clang-format off
|
125
|
+
//! [search-disjunction]
|
126
|
+
auto query = couchbase::disjunction_query{
|
127
|
+
couchbase::match_query("location hostel").field("reviews.content"),
|
128
|
+
couchbase::boolean_field_query(true).field("free_breakfast")
|
129
|
+
};
|
130
|
+
//! [search-disjunction]
|
131
|
+
// clang-format on
|
132
|
+
const auto encoded = query.encode();
|
133
|
+
REQUIRE_FALSE(encoded.ec);
|
134
|
+
REQUIRE(encoded.query == R"(
|
135
|
+
{"disjuncts":[
|
136
|
+
{"field":"reviews.content","match":"location hostel"},
|
137
|
+
{"bool":true,"field":"free_breakfast"}
|
138
|
+
]}
|
139
|
+
)"_json);
|
140
|
+
}
|
141
|
+
|
142
|
+
TEST_CASE("unit: boolean search query", "[unit]")
|
143
|
+
{
|
144
|
+
// clang-format off
|
145
|
+
//! [search-boolean]
|
146
|
+
couchbase::boolean_query query;
|
147
|
+
query.must(
|
148
|
+
couchbase::match_query("hostel room").field("reviews.content"),
|
149
|
+
couchbase::boolean_field_query(true).field("free_breakfast"));
|
150
|
+
query.should(
|
151
|
+
couchbase::numeric_range_query().field("reviews.ratings.Overall").min(4),
|
152
|
+
couchbase::numeric_range_query().field("reviews.ratings.Service").min(5));
|
153
|
+
query.must_not(
|
154
|
+
couchbase::match_query("Padfield Gilingham").field("city"));
|
155
|
+
//! [search-boolean]
|
156
|
+
// clang-format on
|
157
|
+
const auto encoded = query.encode();
|
158
|
+
REQUIRE_FALSE(encoded.ec);
|
159
|
+
REQUIRE(encoded.query == R"(
|
160
|
+
{"must": {"conjuncts":[{"field":"reviews.content","match":"hostel room"},{"bool":true,"field":"free_breakfast"}]},
|
161
|
+
"must_not": {"disjuncts":[{"field":"city","match":"Padfield Gilingham"}]},
|
162
|
+
"should": {"disjuncts":[{"field":"reviews.ratings.Overall","min":4},{"field":"reviews.ratings.Service","min":5}]}}
|
163
|
+
)"_json);
|
164
|
+
}
|
165
|
+
|
166
|
+
TEST_CASE("unit: term search query", "[unit]")
|
167
|
+
{
|
168
|
+
// clang-format off
|
169
|
+
//! [search-term]
|
170
|
+
auto query = couchbase::term_query("locate").field("reviews.content");
|
171
|
+
//! [search-term]
|
172
|
+
// clang-format on
|
173
|
+
const auto encoded = query.encode();
|
174
|
+
REQUIRE_FALSE(encoded.ec);
|
175
|
+
REQUIRE(encoded.query == R"(
|
176
|
+
{"term": "locate", "field": "reviews.content"}
|
177
|
+
)"_json);
|
178
|
+
}
|
179
|
+
|
180
|
+
TEST_CASE("unit: match phrase search query", "[unit]")
|
181
|
+
{
|
182
|
+
// clang-format off
|
183
|
+
//! [search-match-phrase]
|
184
|
+
auto query = couchbase::match_phrase_query("nice view").field("reviews.content");
|
185
|
+
//! [search-match-phrase]
|
186
|
+
// clang-format on
|
187
|
+
const auto encoded = query.encode();
|
188
|
+
REQUIRE_FALSE(encoded.ec);
|
189
|
+
REQUIRE(encoded.query == R"(
|
190
|
+
{"match_phrase": "nice view", "field": "reviews.content"}
|
191
|
+
)"_json);
|
192
|
+
}
|
193
|
+
|
194
|
+
TEST_CASE("unit: phrase search query", "[unit]")
|
195
|
+
{
|
196
|
+
// clang-format off
|
197
|
+
//! [search-phrase]
|
198
|
+
auto query = couchbase::phrase_query({"nice", "view"}).field("reviews.content");
|
199
|
+
//! [search-phrase]
|
200
|
+
// clang-format on
|
201
|
+
const auto encoded = query.encode();
|
202
|
+
REQUIRE_FALSE(encoded.ec);
|
203
|
+
REQUIRE(encoded.query == R"(
|
204
|
+
{"terms": ["nice", "view"], "field": "reviews.content"}
|
205
|
+
)"_json);
|
206
|
+
}
|
207
|
+
|
208
|
+
TEST_CASE("unit: prefix search query", "[unit]")
|
209
|
+
{
|
210
|
+
// clang-format off
|
211
|
+
//! [search-prefix]
|
212
|
+
auto query = couchbase::prefix_query("inter").field("reviews.content");
|
213
|
+
//! [search-prefix]
|
214
|
+
// clang-format on
|
215
|
+
const auto encoded = query.encode();
|
216
|
+
REQUIRE_FALSE(encoded.ec);
|
217
|
+
REQUIRE(encoded.query == R"(
|
218
|
+
{"prefix": "inter", "field": "reviews.content"}
|
219
|
+
)"_json);
|
220
|
+
}
|
221
|
+
|
222
|
+
TEST_CASE("unit: regexp search query", "[unit]")
|
223
|
+
{
|
224
|
+
// clang-format off
|
225
|
+
//! [search-regexp]
|
226
|
+
auto query = couchbase::regexp_query("inter.+").field("reviews.content");
|
227
|
+
//! [search-regexp]
|
228
|
+
// clang-format on
|
229
|
+
const auto encoded = query.encode();
|
230
|
+
REQUIRE_FALSE(encoded.ec);
|
231
|
+
REQUIRE(encoded.query == R"(
|
232
|
+
{"regexp": "inter.+", "field": "reviews.content"}
|
233
|
+
)"_json);
|
234
|
+
}
|
235
|
+
|
236
|
+
TEST_CASE("unit: wildcard search query", "[unit]")
|
237
|
+
{
|
238
|
+
// clang-format off
|
239
|
+
//! [search-wildcard]
|
240
|
+
auto query = couchbase::wildcard_query("inter*").field("reviews.content");
|
241
|
+
//! [search-wildcard]
|
242
|
+
// clang-format on
|
243
|
+
const auto encoded = query.encode();
|
244
|
+
REQUIRE_FALSE(encoded.ec);
|
245
|
+
REQUIRE(encoded.query == R"(
|
246
|
+
{"wildcard": "inter*", "field": "reviews.content"}
|
247
|
+
)"_json);
|
248
|
+
}
|
249
|
+
|
250
|
+
TEST_CASE("unit: numeric range search query", "[unit]")
|
251
|
+
{
|
252
|
+
// clang-format off
|
253
|
+
//! [search-numeric-range]
|
254
|
+
auto query = couchbase::numeric_range_query()
|
255
|
+
.field("id")
|
256
|
+
.min(100, /* inclusive= */ false)
|
257
|
+
.max(1000, /* inclusive= */ false);
|
258
|
+
//! [search-numeric-range]
|
259
|
+
// clang-format on
|
260
|
+
const auto encoded = query.encode();
|
261
|
+
REQUIRE_FALSE(encoded.ec);
|
262
|
+
REQUIRE(encoded.query == R"(
|
263
|
+
{"min": 100, "inclusive_min": false, "max": 1000, "inclusive_max": false, "field": "id"}
|
264
|
+
)"_json);
|
265
|
+
}
|
266
|
+
|
267
|
+
TEST_CASE("unit: date range search query", "[unit]")
|
268
|
+
{
|
269
|
+
{
|
270
|
+
// clang-format off
|
271
|
+
//! [search-date-range]
|
272
|
+
auto query = couchbase::date_range_query()
|
273
|
+
.field("review_date")
|
274
|
+
.start("2001-10-09T10:20:30-08:00", /* inclusive= */ false)
|
275
|
+
.end("2016-10-31", /* inclusive= */ false);
|
276
|
+
//! [search-date-range]
|
277
|
+
// clang-format on
|
278
|
+
const auto encoded = query.encode();
|
279
|
+
REQUIRE_FALSE(encoded.ec);
|
280
|
+
REQUIRE(encoded.query == R"(
|
281
|
+
{"start": "2001-10-09T10:20:30-08:00", "inclusive_start": false, "end": "2016-10-31", "inclusive_end": false, "field": "review_date"}
|
282
|
+
)"_json);
|
283
|
+
}
|
284
|
+
|
285
|
+
{
|
286
|
+
// clang-format off
|
287
|
+
//! [search-date-range-tm]
|
288
|
+
std::tm start_tm{};
|
289
|
+
start_tm.tm_year = 2001 - 1900;
|
290
|
+
start_tm.tm_mon = 9;
|
291
|
+
start_tm.tm_mday = 9;
|
292
|
+
start_tm.tm_hour = 10;
|
293
|
+
start_tm.tm_min = 20;
|
294
|
+
start_tm.tm_sec = 30;
|
295
|
+
|
296
|
+
std::tm end_tm{};
|
297
|
+
end_tm.tm_year = 2001 - 1900;
|
298
|
+
end_tm.tm_mon = 9;
|
299
|
+
end_tm.tm_mday = 31;
|
300
|
+
|
301
|
+
auto query = couchbase::date_range_query()
|
302
|
+
.field("review_date")
|
303
|
+
.start(start_tm)
|
304
|
+
.end(end_tm);
|
305
|
+
// equivalent of {"field":"review_date","start":"2001-10-09T10:20:30+0000","end":"2001-10-31T00:00:00+0000"}
|
306
|
+
//! [search-date-range-tm]
|
307
|
+
// clang-format on
|
308
|
+
const auto encoded = query.encode();
|
309
|
+
REQUIRE_FALSE(encoded.ec);
|
310
|
+
REQUIRE(encoded.query == R"(
|
311
|
+
{"end":"2001-10-31T00:00:00+0000","field":"review_date","start":"2001-10-09T10:20:30+0000"}
|
312
|
+
)"_json);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
316
|
+
TEST_CASE("unit: term range search query", "[unit]")
|
317
|
+
{
|
318
|
+
// clang-format off
|
319
|
+
//! [search-term-range]
|
320
|
+
auto query = couchbase::term_range_query()
|
321
|
+
.field("desc")
|
322
|
+
.min("foo", /* inclusive= */ false)
|
323
|
+
.max("foof", /* inclusive= */ false);
|
324
|
+
//! [search-term-range]
|
325
|
+
// clang-format on
|
326
|
+
const auto encoded = query.encode();
|
327
|
+
REQUIRE_FALSE(encoded.ec);
|
328
|
+
REQUIRE(encoded.query == R"(
|
329
|
+
{"min": "foo", "inclusive_min": false, "max": "foof", "inclusive_max": false, "field": "desc"}
|
330
|
+
)"_json);
|
331
|
+
}
|
332
|
+
|
333
|
+
TEST_CASE("unit: special search query", "[unit]")
|
334
|
+
{
|
335
|
+
{
|
336
|
+
auto query = couchbase::match_none_query();
|
337
|
+
const auto encoded = query.encode();
|
338
|
+
REQUIRE_FALSE(encoded.ec);
|
339
|
+
REQUIRE(encoded.query == R"({"match_none": {}})"_json);
|
340
|
+
}
|
341
|
+
{
|
342
|
+
auto query = couchbase::match_all_query();
|
343
|
+
const auto encoded = query.encode();
|
344
|
+
REQUIRE_FALSE(encoded.ec);
|
345
|
+
REQUIRE(encoded.query == R"({"match_all": {}})"_json);
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
TEST_CASE("unit: geo distance search query", "[unit]")
|
350
|
+
{
|
351
|
+
// clang-format off
|
352
|
+
//! [search-geo-distance]
|
353
|
+
auto query = couchbase::geo_distance_query(53.482358, -2.235143, "100mi")
|
354
|
+
.field("geo");
|
355
|
+
//! [search-geo-distance]
|
356
|
+
// clang-format on
|
357
|
+
const auto encoded = query.encode();
|
358
|
+
REQUIRE_FALSE(encoded.ec);
|
359
|
+
REQUIRE(encoded.query == R"(
|
360
|
+
{
|
361
|
+
"location": {
|
362
|
+
"lon": -2.235143,
|
363
|
+
"lat": 53.482358
|
364
|
+
},
|
365
|
+
"distance": "100mi",
|
366
|
+
"field": "geo"
|
367
|
+
}
|
368
|
+
)"_json);
|
369
|
+
}
|
370
|
+
|
371
|
+
TEST_CASE("unit: geo bounding box search query", "[unit]")
|
372
|
+
{
|
373
|
+
// clang-format off
|
374
|
+
//! [search-geo-bounding-box]
|
375
|
+
auto query = couchbase::geo_bounding_box_query(
|
376
|
+
couchbase::geo_point{53.482358, -2.235143},
|
377
|
+
couchbase::geo_point{40.991862, 28.955043}
|
378
|
+
).field("geo");
|
379
|
+
//! [search-geo-bounding-box]
|
380
|
+
// clang-format on
|
381
|
+
const auto encoded = query.encode();
|
382
|
+
REQUIRE_FALSE(encoded.ec);
|
383
|
+
REQUIRE(encoded.query == R"(
|
384
|
+
{
|
385
|
+
"top_left": {
|
386
|
+
"lon": -2.235143,
|
387
|
+
"lat": 53.482358
|
388
|
+
},
|
389
|
+
"bottom_right": {
|
390
|
+
"lon": 28.955043,
|
391
|
+
"lat": 40.991862
|
392
|
+
},
|
393
|
+
"field": "geo"
|
394
|
+
}
|
395
|
+
)"_json);
|
396
|
+
}
|
397
|
+
|
398
|
+
TEST_CASE("unit: geo polygon search query", "[unit]")
|
399
|
+
{
|
400
|
+
// clang-format off
|
401
|
+
//! [search-geo-polygon]
|
402
|
+
auto query = couchbase::geo_polygon_query({
|
403
|
+
couchbase::geo_point{ 37.79393211306212, -122.44234633404847 },
|
404
|
+
couchbase::geo_point{ 37.77995881733997, -122.43977141339417 },
|
405
|
+
couchbase::geo_point{ 37.788031092020155, -122.42925715405579 },
|
406
|
+
couchbase::geo_point{ 37.79026946582319, -122.41149020154114 },
|
407
|
+
couchbase::geo_point{ 37.79571192027403, -122.40735054016113 },
|
408
|
+
couchbase::geo_point{ 37.79393211306212, -122.44234633404847 },
|
409
|
+
}).field("geo");
|
410
|
+
//! [search-geo-polygon]
|
411
|
+
// clang-format on
|
412
|
+
const auto encoded = query.encode();
|
413
|
+
REQUIRE_FALSE(encoded.ec);
|
414
|
+
REQUIRE(encoded.query == R"(
|
415
|
+
{
|
416
|
+
"field": "geo",
|
417
|
+
"polygon_points": [
|
418
|
+
{"lat": 37.79393211306212, "lon": -122.44234633404847},
|
419
|
+
{"lat": 37.77995881733997, "lon": -122.43977141339417},
|
420
|
+
{"lat": 37.788031092020155, "lon": -122.42925715405579},
|
421
|
+
{"lat": 37.79026946582319, "lon": -122.41149020154114},
|
422
|
+
{"lat": 37.79571192027403, "lon": -122.40735054016113},
|
423
|
+
{"lat": 37.79393211306212, "lon": -122.44234633404847}
|
424
|
+
]
|
425
|
+
}
|
426
|
+
)"_json);
|
427
|
+
}
|
@@ -63,7 +63,7 @@ build_origin(const test_context& ctx,
|
|
63
63
|
ctx.dns_nameserver.value_or(couchbase::core::io::dns::dns_config::default_nameserver),
|
64
64
|
ctx.dns_port.value_or(couchbase::core::io::dns::dns_config::default_port),
|
65
65
|
};
|
66
|
-
if (ctx.deployment == deployment_type::capella) {
|
66
|
+
if (ctx.deployment == deployment_type::capella || ctx.deployment == test::utils::deployment_type::elixir) {
|
67
67
|
origin.options().apply_profile("wan_development");
|
68
68
|
}
|
69
69
|
return origin;
|
@@ -213,6 +213,7 @@ integration_test_guard::cluster_version()
|
|
213
213
|
auto parsed_version = server_version::parse(runtime_version, ctx.deployment);
|
214
214
|
parsed_version.profile = runtime_pools_info.config_profile;
|
215
215
|
parsed_version.developer_preview = runtime_pools_info.is_developer_preview;
|
216
|
+
parsed_version.use_gocaves = ctx.version.use_gocaves;
|
216
217
|
if (parsed_version.major == 0) {
|
217
218
|
/* the build does not specify version properly */
|
218
219
|
return ctx.version;
|
@@ -32,7 +32,9 @@ init_logger()
|
|
32
32
|
if (auto env_val = spdlog::details::os::getenv("TEST_LOG_LEVEL"); !env_val.empty()) {
|
33
33
|
couchbase::core::logger::set_log_levels(couchbase::core::logger::level_from_str(env_val));
|
34
34
|
}
|
35
|
-
|
35
|
+
if (auto env_val = spdlog::details::os::getenv("TEST_LOG_INCLUDE_LOCATION"); !env_val.empty()) {
|
36
|
+
spdlog::set_pattern("[%Y-%m-%d %T.%e] [%P,%t] [%^%l%$] %oms, %v at %@ %!");
|
37
|
+
}
|
36
38
|
initialized = true;
|
37
39
|
}
|
38
40
|
}
|
@@ -38,8 +38,14 @@ struct server_version {
|
|
38
38
|
server_edition edition{ server_edition::unknown };
|
39
39
|
deployment_type deployment{ deployment_type::on_prem };
|
40
40
|
server_config_profile profile{ server_config_profile::unknown };
|
41
|
+
bool use_gocaves{ false };
|
41
42
|
|
42
|
-
static server_version parse(const std::string& str,
|
43
|
+
static server_version parse(const std::string& str, deployment_type deployment);
|
44
|
+
|
45
|
+
[[nodiscard]] bool is_mock() const
|
46
|
+
{
|
47
|
+
return use_gocaves;
|
48
|
+
}
|
43
49
|
|
44
50
|
[[nodiscard]] bool is_alice() const
|
45
51
|
{
|
@@ -97,7 +103,7 @@ struct server_version {
|
|
97
103
|
|
98
104
|
[[nodiscard]] bool supports_preserve_expiry() const
|
99
105
|
{
|
100
|
-
return is_cheshire_cat() || is_neo();
|
106
|
+
return !use_gocaves && (is_cheshire_cat() || is_neo());
|
101
107
|
}
|
102
108
|
|
103
109
|
[[nodiscard]] bool supports_preserve_expiry_for_query() const
|
@@ -112,27 +118,37 @@ struct server_version {
|
|
112
118
|
|
113
119
|
[[nodiscard]] bool supports_query_index_management() const
|
114
120
|
{
|
115
|
-
return is_mad_hatter() || is_cheshire_cat() || is_neo();
|
121
|
+
return !use_gocaves && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
116
122
|
}
|
117
123
|
|
118
124
|
[[nodiscard]] bool supports_analytics() const
|
119
125
|
{
|
120
|
-
return is_enterprise() && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
126
|
+
return !use_gocaves && is_enterprise() && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
127
|
+
}
|
128
|
+
|
129
|
+
[[nodiscard]] bool supports_query() const
|
130
|
+
{
|
131
|
+
return !use_gocaves;
|
132
|
+
}
|
133
|
+
|
134
|
+
[[nodiscard]] bool supports_search() const
|
135
|
+
{
|
136
|
+
return !use_gocaves;
|
121
137
|
}
|
122
138
|
|
123
139
|
[[nodiscard]] bool supports_analytics_pending_mutations() const
|
124
140
|
{
|
125
|
-
return is_mad_hatter() || is_cheshire_cat() || is_neo();
|
141
|
+
return supports_analytics() && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
126
142
|
}
|
127
143
|
|
128
144
|
[[nodiscard]] bool supports_analytics_link_azure_blob() const
|
129
145
|
{
|
130
|
-
return is_cheshire_cat() && developer_preview;
|
146
|
+
return supports_analytics() && is_cheshire_cat() && developer_preview;
|
131
147
|
}
|
132
148
|
|
133
149
|
[[nodiscard]] bool supports_analytics_links() const
|
134
150
|
{
|
135
|
-
return (major == 6 && minor >= 6) || major > 6;
|
151
|
+
return supports_analytics() && ((major == 6 && minor >= 6) || major > 6);
|
136
152
|
}
|
137
153
|
|
138
154
|
[[nodiscard]] bool supports_minimum_durability_level() const
|
@@ -142,17 +158,17 @@ struct server_version {
|
|
142
158
|
|
143
159
|
[[nodiscard]] bool supports_search_analyze() const
|
144
160
|
{
|
145
|
-
return is_mad_hatter() || is_cheshire_cat() || is_neo();
|
161
|
+
return supports_search() && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
146
162
|
}
|
147
163
|
|
148
164
|
[[nodiscard]] bool supports_analytics_links_cert_auth() const
|
149
165
|
{
|
150
|
-
return is_neo();
|
166
|
+
return supports_analytics() && is_neo();
|
151
167
|
}
|
152
168
|
|
153
169
|
[[nodiscard]] bool supports_eventing_functions() const
|
154
170
|
{
|
155
|
-
return is_enterprise() && (is_cheshire_cat() || is_neo()) && deployment == deployment_type::on_prem;
|
171
|
+
return !use_gocaves && is_enterprise() && (is_cheshire_cat() || is_neo()) && deployment == deployment_type::on_prem;
|
156
172
|
}
|
157
173
|
|
158
174
|
[[nodiscard]] bool is_enterprise() const
|
@@ -167,22 +183,22 @@ struct server_version {
|
|
167
183
|
|
168
184
|
[[nodiscard]] bool supports_bucket_management() const
|
169
185
|
{
|
170
|
-
return deployment == deployment_type::on_prem;
|
186
|
+
return !use_gocaves && deployment == deployment_type::on_prem;
|
171
187
|
}
|
172
188
|
|
173
189
|
[[nodiscard]] bool supports_user_management() const
|
174
190
|
{
|
175
|
-
return deployment == deployment_type::on_prem;
|
191
|
+
return !use_gocaves && deployment == deployment_type::on_prem;
|
176
192
|
}
|
177
193
|
|
178
194
|
[[nodiscard]] bool requires_search_replicas() const
|
179
195
|
{
|
180
|
-
return deployment == deployment_type::capella || is_serverless_config_profile();
|
196
|
+
return deployment == deployment_type::elixir || deployment == deployment_type::capella || is_serverless_config_profile();
|
181
197
|
}
|
182
198
|
|
183
199
|
[[nodiscard]] bool supports_views() const
|
184
200
|
{
|
185
|
-
return deployment == deployment_type::on_prem && (major < 7 || (major == 7 && minor < 2));
|
201
|
+
return !use_gocaves && deployment == deployment_type::on_prem && (major < 7 || (major == 7 && minor < 2));
|
186
202
|
}
|
187
203
|
|
188
204
|
[[nodiscard]] bool supports_memcached_buckets() const
|
@@ -197,7 +213,7 @@ struct server_version {
|
|
197
213
|
|
198
214
|
[[nodiscard]] bool supports_search_disable_scoring() const
|
199
215
|
{
|
200
|
-
return is_mad_hatter() || is_cheshire_cat() || is_neo();
|
216
|
+
return supports_search() && (is_mad_hatter() || is_cheshire_cat() || is_neo());
|
201
217
|
}
|
202
218
|
};
|
203
219
|
|
@@ -92,6 +92,14 @@ test_context::load_from_environment()
|
|
92
92
|
ctx.number_of_io_threads = std::stoul(var);
|
93
93
|
}
|
94
94
|
|
95
|
+
if (auto var = spdlog::details::os::getenv("TEST_USE_GOCAVES"); !var.empty()) {
|
96
|
+
if (var == "true" || var == "yes" || var == "1") {
|
97
|
+
ctx.version.use_gocaves = true;
|
98
|
+
} else if (var == "false" || var == "no" || var == "0") {
|
99
|
+
ctx.version.use_gocaves = false;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
95
103
|
return ctx;
|
96
104
|
}
|
97
105
|
} // namespace test::utils
|
@@ -47,6 +47,7 @@ Usage:
|
|
47
47
|
|
48
48
|
Options:
|
49
49
|
-h --help Show this screen.
|
50
|
+
--verbose Include more context and information where it is applicable.
|
50
51
|
--bucket-name=STRING Name of the bucket. [default: {bucket_name}]
|
51
52
|
--scope-name=STRING Name of the scope. [default: {scope_name}]
|
52
53
|
--collection-name=STRING Name of the collection. [default: {collection_name}]
|
@@ -79,6 +80,7 @@ struct command_options {
|
|
79
80
|
bool hexdump{ false };
|
80
81
|
bool pretty_json{ false };
|
81
82
|
bool json_lines{ false };
|
83
|
+
bool verbose{ false };
|
82
84
|
};
|
83
85
|
|
84
86
|
static void
|
@@ -141,16 +143,14 @@ print_result(const std::string& bucket_name,
|
|
141
143
|
} else {
|
142
144
|
fmt::print(stderr, "{}, error: {}\n", prefix, ctx.ec().message());
|
143
145
|
}
|
146
|
+
if (cmd_options.verbose) {
|
147
|
+
fmt::print(stderr, "{}\n", ctx.to_json());
|
148
|
+
}
|
144
149
|
} else {
|
145
150
|
auto [value, flags] = resp.content_as<cbc::passthrough_transcoder>();
|
146
|
-
if (resp.expiry_time()) {
|
147
|
-
fmt::print(
|
148
|
-
|
149
|
-
prefix,
|
150
|
-
value.size(),
|
151
|
-
resp.cas(),
|
152
|
-
flags,
|
153
|
-
resp.expiry_time().value());
|
151
|
+
if (const auto& exptime = resp.expiry_time(); exptime.has_value()) {
|
152
|
+
fmt::print(
|
153
|
+
stderr, "{}, size: {}, CAS: 0x{}, flags: 0x{:08x}, expiry: {}\n", prefix, value.size(), resp.cas(), flags, exptime.value());
|
154
154
|
} else {
|
155
155
|
fmt::print(stderr, "{}, size: {}, CAS: 0x{}, flags: 0x{:08x}\n", prefix, value.size(), resp.cas(), flags);
|
156
156
|
}
|
@@ -247,6 +247,7 @@ cbc::get::execute(const std::vector<std::string>& argv)
|
|
247
247
|
cbc::fill_cluster_options(options, cluster_options, connection_string);
|
248
248
|
|
249
249
|
command_options cmd_options{};
|
250
|
+
cmd_options.verbose = options["--verbose"].asBool();
|
250
251
|
cmd_options.bucket_name = options["--bucket-name"].asString();
|
251
252
|
cmd_options.scope_name = options["--scope-name"].asString();
|
252
253
|
cmd_options.collection_name = options["--collection-name"].asString();
|