Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
scope.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present 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#pragma once
19
27
28#include <memory>
29
30namespace couchbase
31{
32#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
33namespace core
34{
35class cluster;
36} // namespace core
37class bucket;
38class scope_impl;
39#endif
40
46class scope
47{
48public:
55 static constexpr auto default_name{ "_default" };
56
65 [[nodiscard]] auto bucket_name() const -> const std::string&;
66
75 [[nodiscard]] auto name() const -> const std::string&;
76
86 [[nodiscard]] auto collection(std::string_view collection_name) const -> collection;
87
101 void query(std::string statement, const query_options& options, query_handler&& handler) const;
102
113 [[nodiscard]] auto query(std::string statement, const query_options& options = {}) const
114 -> std::future<std::pair<error, query_result>>;
115
139 void query_stream(std::string statement,
140 const query_options& options,
141 query_stream_handler&& handler) const;
142
159 [[nodiscard]] auto query_stream(std::string statement, const query_options& options = {}) const
160 -> std::future<std::pair<error, query_stream_result>>;
161
180 void search(std::string index_name,
181 search_request request,
182 const search_options& options,
183 search_handler&& handler) const;
184
203 [[nodiscard]] auto search(std::string index_name,
204 search_request request,
205 const search_options& options = {}) const
206 -> std::future<std::pair<error, search_result>>;
207
223 void analytics_query(std::string statement,
224 const analytics_options& options,
225 analytics_handler&& handler) const;
226
239 [[nodiscard]] auto analytics_query(std::string statement,
240 const analytics_options& options = {}) const
241 -> std::future<std::pair<error, analytics_result>>;
242
256 void analytics_query_stream(std::string statement,
257 const analytics_options& options,
258 analytics_stream_handler&& handler) const;
259
275 [[nodiscard]] auto analytics_query_stream(std::string statement,
276 const analytics_options& options = {}) const
277 -> std::future<std::pair<error, analytics_stream_result>>;
278
287 [[nodiscard]] auto search_indexes() const -> scope_search_index_manager;
288
289private:
290 friend class bucket;
291
292 scope(core::cluster core,
293 std::string_view bucket_name,
294 std::string_view name,
295 std::shared_ptr<crypto::manager> crypto_manager);
296
297 std::shared_ptr<scope_impl> impl_;
298};
299} // namespace couchbase
Provides access to Couchbase bucket.
Definition bucket.hxx:51
The cluster is the main entry point when connecting to a Couchbase cluster.
Definition cluster.hxx:62
Definition scope_search_index_manager.hxx:51
friend class bucket
Definition scope.hxx:290
auto bucket_name() const -> const std::string &
Returns name of the bucket where the scope is defined.
static constexpr auto default_name
Constant for the name of the default scope in the bucket.
Definition scope.hxx:55
auto analytics_query_stream(std::string statement, const analytics_options &options={}) const -> std::future< std::pair< error, analytics_stream_result > >
Performs a streaming query against the analytics services.
auto search(std::string index_name, search_request request, const search_options &options={}) const -> std::future< std::pair< error, search_result > >
Performs a request against the full text search services.
auto search_indexes() const -> scope_search_index_manager
Provides access to search index management services at the scope level.
auto analytics_query(std::string statement, const analytics_options &options={}) const -> std::future< std::pair< error, analytics_result > >
Performs a query against the analytics services.
void query_stream(std::string statement, const query_options &options, query_stream_handler &&handler) const
Performs a streaming query against the query (N1QL) services.
auto query_stream(std::string statement, const query_options &options={}) const -> std::future< std::pair< error, query_stream_result > >
Performs a streaming query against the query (N1QL) services.
void search(std::string index_name, search_request request, const search_options &options, search_handler &&handler) const
Performs a request against the full text search services.
auto name() const -> const std::string &
Returns name of the scope.
auto collection(std::string_view collection_name) const -> collection
Opens a collection for this scope with an explicit name.
void query(std::string statement, const query_options &options, query_handler &&handler) const
Performs a query against the query (N1QL) services.
void analytics_query(std::string statement, const analytics_options &options, analytics_handler &&handler) const
Performs a query against the analytics services.
void analytics_query_stream(std::string statement, const analytics_options &options, analytics_stream_handler &&handler) const
Performs a streaming query against the analytics services.
A search_request is used to perform operations against the Full Text Search (FTS) Couchbase service.
Definition search_request.hxx:46
Definition expiry.hxx:24
Definition internal.hxx:27
Represents a single item from the result of scan().
Definition allow_querying_search_index_options.hxx:28
std::function< void(error, query_stream_result)> query_stream_handler
The signature for the handler of a streaming query operation.
Definition query_options.hxx:688
std::function< void(error, search_result)> search_handler
The signature for the handler of the search() and search() operations.
Definition search_options.hxx:529
std::function< void(error, analytics_stream_result)> analytics_stream_handler
The signature for the handler of the analytics_query_stream() and analytics_query_stream() operations...
Definition analytics_options.hxx:476
std::function< void(error, query_result)> query_handler
The signature for the handler of the query() and query() operations.
Definition query_options.hxx:680
std::function< void(error, analytics_result)> analytics_handler
The signature for the handler of the analytics_query() and analytics_query() operations.
Definition analytics_options.hxx:467
Options for cluster::analytics_query() and scope::analytics_query().
Definition analytics_options.hxx:46
Options for cluster::query() and scope::query().
Definition query_options.hxx:47
Options for search() and search().
Definition search_options.hxx:47