func sessionFromRPC(session *pbg.Session) { if session == nil { return } if len(session.ShardSessions) == 0 { session.ShardSessions = nil } }
func sessionFromRPC(session *vtgatepb.Session) interface{} { if session == nil { return nil } if len(session.ShardSessions) == 0 { session.ShardSessions = nil } return session }
// requestToPartialError fills reply for a partial error if requested // (that is, an error that may change the session). // It returns true if a partial error was requested, false otherwise. // This partial error should only be returned by Execute* calls. func requestToPartialError(request string, session *vtgatepb.Session) error { if !strings.HasPrefix(request, PartialErrorPrefix) { return nil } request = strings.TrimPrefix(request, PartialErrorPrefix) parts := strings.Split(request, "/") if len(parts) > 1 && parts[1] == "close transaction" { session.InTransaction = false } return trimmedRequestToError(parts[0]) }
func (c *successClient) Begin(ctx context.Context, outSession *pbg.Session) error { outSession.InTransaction = true return nil }
// Begin begins a transaction. It has to be concluded by a Commit or Rollback. func (vtg *VTGate) Begin(ctx context.Context, outSession *vtgatepb.Session) error { outSession.InTransaction = true return nil }