|
| Row () |
| Default constructs an empty row with no columns nor values. More...
|
|
std::size_t | size () const |
| Returns the number of columns in the row. More...
|
|
std::vector< std::string > const & | columns () const |
| Returns the column names for the row. More...
|
|
std::vector< Value > const & | values () const & |
| Returns the Value objects in the given row. More...
|
|
std::vector< Value > && | values () && |
| Returns the Value objects in the given row. More...
|
|
StatusOr< Value > | get (std::size_t pos) const |
| Returns the Value at the given pos . More...
|
|
StatusOr< Value > | get (std::string const &name) const |
| Returns the Value in the column with name . More...
|
|
template<typename T , typename Arg > |
StatusOr< T > | get (Arg &&arg) const |
| Returns the native C++ value at the given position or column name. More...
|
|
template<typename Tuple > |
StatusOr< Tuple > | get () const & |
| Returns all the native C++ values for the whole row in a std::tuple with the specified type. More...
|
|
template<typename Tuple > |
StatusOr< Tuple > | get () && |
| Returns all the native C++ values for the whole row in a std::tuple with the specified type. More...
|
|
|
| Row (Row const &)=default |
|
Row & | operator= (Row const &)=default |
|
| Row (Row &&)=default |
|
Row & | operator= (Row &&)=default |
|
A Row
is a sequence of columns each with a name and an associated Value
.
The Row
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.
Row
instances are typically returned as the result of queries or reads of a Cloud Spanner table (see Client::Read
and Client::ExecuteQuery
). Users will mostly just use the accessor methods on Row, and will rarely (if ever) need to construct a
Row` of their own.
The number of columns in a Row
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
std::cout << "LastName=" << *x << "\n";
}
A Row is a sequence of columns each with a name and an associated Value.
Definition: row.h:84
StatusOr< Value > get(std::size_t pos) const
Returns the Value at the given pos.