Google Cloud Spanner C++ Client
2.7.0
A C++ Client Library for Google Cloud Spanner
read_options.h
Go to the documentation of this file.
1
// Copyright 2019 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#
ifndef
GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_READ_OPTIONS_H
16
#
define
GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_READ_OPTIONS_H
17
18
#
include
"google/cloud/spanner/request_priority.h"
19
#
include
"google/cloud/spanner/version.h"
20
#
include
"google/cloud/optional.h"
21
#
include
"google/cloud/options.h"
22
#
include
"absl/types/optional.h"
23
#
include
<
cstdint
>
24
#
include
<
string
>
25
26
namespace
google
{
27
namespace
cloud
{
28
namespace
spanner
{
29
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
30
31
/// Options passed to `Client::Read` or `Client::PartitionRead`.
32
struct
ReadOptions
{
33
/**
34
* If non-empty, the name of an index on a database table. This index is
35
* used instead of the table primary key when interpreting the `KeySet`
36
* and sorting result rows.
37
*/
38
std::string
index_name
;
39
40
/**
41
* Limit on the number of rows to yield, or 0 for no limit.
42
* A limit cannot be specified when calling `PartitionRead`.
43
*/
44
std::int64_t
limit
= 0;
45
46
/**
47
* Priority for the read request.
48
*/
49
absl::optional<
RequestPriority
>
request_priority
;
50
51
/**
52
* Tag for the read request.
53
*/
54
absl::optional<std::string>
request_tag
;
55
};
56
57
inline
bool
operator
==(
ReadOptions
const
& lhs,
ReadOptions
const
& rhs) {
58
return
lhs
.
limit
== rhs
.
limit
&&
59
lhs
.
request_priority
== rhs
.
request_priority
&&
60
lhs
.
request_tag
== rhs
.
request_tag
&& lhs
.
index_name
== rhs
.
index_name
;
61
}
62
63
inline
bool
operator
!=(
ReadOptions
const
& lhs,
ReadOptions
const
& rhs) {
64
return
!(lhs
==
rhs);
65
}
66
67
/// Converts `ReadOptions` to common `Options`.
68
Options
ToOptions
(
ReadOptions
const
&);
69
70
/// Converts common `Options` to `ReadOptions`.
71
ReadOptions
ToReadOptions
(
Options
const
&);
72
73
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
74
}
// namespace spanner
75
}
// namespace cloud
76
}
// namespace google
77
78
#
endif
// GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_READ_OPTIONS_H
Generated on Wed Feb 1 2023 20:31:34 for Google Cloud Spanner C++ Client by
1.9.1