MCPcopy Index your code
hub / github.com/cloudspannerecosystem/spanner-cli / runQueryWithOptions

Method runQueryWithOptions

session.go:268–285  ·  view source on GitHub ↗
(ctx context.Context, stmt spanner.Statement, opts spanner.QueryOptions)

Source from the content-addressed store, hash-verified

266}
267
268func (s *Session) runQueryWithOptions(ctx context.Context, stmt spanner.Statement, opts spanner.QueryOptions) (*spanner.RowIterator, *spanner.ReadOnlyTransaction) {
269 if s.InReadWriteTransaction() {
270 // The current Go Spanner client library does not apply client-level directed read options to read-write transactions.
271 // Therefore, we explicitly set query-level options here to fail the query during a read-write transaction.
272 opts.DirectedReadOptions = s.clientConfig.DirectedReadOptions
273 opts.RequestTag = s.tc.tag
274 iter := s.tc.rwTxn.QueryWithOptions(ctx, stmt, opts)
275 s.tc.sendHeartbeat = true
276 return iter, nil
277 }
278 if s.InReadOnlyTransaction() {
279 opts.RequestTag = s.tc.tag
280 return s.tc.roTxn.QueryWithOptions(ctx, stmt, opts), s.tc.roTxn
281 }
282
283 txn := s.client.Single()
284 return txn.QueryWithOptions(ctx, stmt, opts), txn
285}
286
287// RunUpdate executes a DML statement on the running read-write transaction.
288// It returns error if there is no running read-write transaction.

Callers 3

RunQueryWithStatsMethod · 0.95
RunQueryMethod · 0.95
RunAnalyzeQueryMethod · 0.95

Calls 2

InReadOnlyTransactionMethod · 0.95

Tested by

no test coverage detected