Couchbase C++ SDK 1.0.2 (rev. 51f4775)
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
134 void search(std::string index_name,
135 search_request request,
136 const search_options& options,
137 search_handler&& handler) const;
138
157 [[nodiscard]] auto search(std::string index_name,
158 search_request request,
159 const search_options& options = {}) const
160 -> std::future<std::pair<error, search_result>>;
161
177 void analytics_query(std::string statement,
178 const analytics_options& options,
179 analytics_handler&& handler) const;
180
193 [[nodiscard]] auto analytics_query(std::string statement, const analytics_options& options = {})
194 const -> std::future<std::pair<error, analytics_result>>;
195
204 [[nodiscard]] auto search_indexes() const -> scope_search_index_manager;
205
206private:
207 friend class bucket;
208
209 scope(core::cluster core, std::string_view bucket_name, std::string_view name);
210
211 std::shared_ptr<scope_impl> impl_;
212};
213} // namespace couchbase
Provides access to Couchbase bucket.
Definition bucket.hxx:45
The cluster is the main entry point when connecting to a Couchbase cluster.
Definition cluster.hxx:60
The collection provides access to all collection APIs.
Definition collection.hxx:70
Definition scope_search_index_manager.hxx:51
The scope identifies a group of collections and allows high application density as a result.
Definition scope.hxx:47
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 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 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.
void analytics_query(std::string statement, const analytics_options &options, analytics_handler &&handler) const
Performs a 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
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
@ query
The Query service (SQL++)
std::function< void(error, search_result)> search_handler
The signature for the handler of the cluster::search() and scope::search() operations.
Definition search_options.hxx:528
std::function< void(error, query_result)> query_handler
The signature for the handler of the cluster::query() and scope::query() operations.
Definition query_options.hxx:612
std::function< void(error, analytics_result)> analytics_handler
The signature for the handler of the cluster::analytics_query() and scope::analytics_query() operatio...
Definition analytics_options.hxx:400
Options for cluster::analytics_query() and scope::analytics_query().
Definition analytics_options.hxx:45
Options for cluster::query() and scope::query().
Definition query_options.hxx:46
Options for cluster::search() and scope::search().
Definition search_options.hxx:47