fake_db_client.go 519 B

1234567891011121314151617181920212223
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package oracledbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver"
  4. import (
  5. "context"
  6. )
  7. type fakeDbClient struct {
  8. Err error
  9. Responses [][]metricRow
  10. RequestCounter int
  11. }
  12. func (c *fakeDbClient) metricRows(context.Context) ([]metricRow, error) {
  13. if c.Err != nil {
  14. return nil, c.Err
  15. }
  16. idx := c.RequestCounter
  17. c.RequestCounter++
  18. return c.Responses[idx], nil
  19. }