The QueryRow
class is a regular value type that may be copied, moved, assigned, compared for equality, etc. Instances may be large if they hold lots of Value
data, so copy only when necessary.
QueryRow
instances are typically returned as the result of queries or reads of a Cloud Bigtable table (see Client::Read
and Client::ExecuteQuery
). Users will mostly just use the accessor methods on QueryRow
, and will rarely (if ever) need to construct a
QueryRow` of their own.
The number of columns in a QueryRow
can be obtained from the size()
member function. The Value
s can be obtained using the values()
accessor. The names of each column in the row can be obtained using the columns()
accessor.
Perhaps the most convenient way to access the Values
in a row is through the variety of "get" accessors. A user may access a column's Value
by calling get
with a std::size_t
0-indexed position, or a std::string
column name. Furthermore, callers may directly extract the native C++ type by specifying the C++ type along with the column's position or name.
Example
QueryRow row = ...;
if (StatusOr<std::string> x = row.get<std::string>("LastName")) {
std::cout << "LastName=" << *x << "\n";
}
Constructors
QueryRow(QueryRow const &)
Copy and move.
Parameter | |
---|---|
Name | Description |
|
QueryRow const &
|
QueryRow(QueryRow &&)
Copy and move.
Parameter | |
---|---|
Name | Description |
|
QueryRow &&
|
QueryRow()
Default constructs an empty row with no columns nor values.
Operators
operator=(QueryRow const &)
Copy and move.
Parameter | |
---|---|
Name | Description |
|
QueryRow const &
|
Returns | |
---|---|
Type | Description |
QueryRow & |
operator=(QueryRow &&)
Copy and move.
Parameter | |
---|---|
Name | Description |
|
QueryRow &&
|
Returns | |
---|---|
Type | Description |
QueryRow & |
Functions
size() const
Returns the number of columns in the row.
Returns | |
---|---|
Type | Description |
std::size_t |
columns() const
Returns the column names for the row.
Returns | |
---|---|
Type | Description |
std::vector< std::string > const & |
values() const &
Returns the Value
objects in the given row.
Returns | |
---|---|
Type | Description |
std::vector< Value > const & |
values() &&
Returns the Value
objects in the given row.
Returns | |
---|---|
Type | Description |
std::vector< Value > && |
get(std::size_t) const
Returns the Value
at the given pos
.
Parameter | |
---|---|
Name | Description |
pos |
std::size_t
|
Returns | |
---|---|
Type | Description |
StatusOr< Value > |
get(std::string const &) const
Returns the Value
in the column with name
.
Parameter | |
---|---|
Name | Description |
name |
std::string const &
|
Returns | |
---|---|
Type | Description |
StatusOr< Value > |
get(Arg &&) const
Returns the native C++ value at the given position or column name.
Parameters | |
---|---|
Name | Description |
arg |
Arg &&
|
typename T |
the native C++ type, e.g., std::int64_t or std::string |
typename Arg |
a deduced parameter convertible to a std::size_t or std::string |
Returns | |
---|---|
Type | Description |
StatusOr< T > |
get() const &
Returns all the native C++ values for the whole row in a std::tuple
with the specified type.
Parameter | |
---|---|
Name | Description |
typename Tuple |
the |
Returns | |
---|---|
Type | Description |
StatusOr< Tuple > |
get() &&
Returns all the native C++ values for the whole row in a std::tuple
with the specified type.
Parameter | |
---|---|
Name | Description |
typename Tuple |
the |
Returns | |
---|---|
Type | Description |
StatusOr< Tuple > |