Class MockResultSetSource (2.29.0)

Mock the results of a ExecuteQuery() or Read() operation.

See Also

Mocking the Cloud Spanner C++ Client with Google Mock for an example using this class.

Functions

NextRow()

Returns the next row in the stream.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Returns
Type Description
StatusOr< spanner::Row >

if the stream is interrupted due to a failure the StatusOr<spanner::Row> contains the error. The function returns a successful StatusOr<> with an empty spanner::Row to indicate end-of-stream.

Metadata()

Returns metadata about the result set, such as the field types and the transaction id created by the request.

See Also

https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#resultsetmetadata for more information.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Returns
Type Description
absl::optional< google::spanner::v1::ResultSetMetadata >

Stats() const

Returns statistics about the result set, such as the number of rows, and the query plan used to compute the results.

See Also

https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#resultsetstats for more information.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Returns
Type Description
absl::optional< google::spanner::v1::ResultSetStats >