bqfake

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package bqfake provides tools to construct fake bigquery datasets, tables, query responses, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	bqiface.Client
	// contains filtered or unexported fields
}

Client implements a fake client.

func NewClient

func NewClient(ctx context.Context, project string, opts ...option.ClientOption) (*Client, error)

NewClient creates a new Client implementing bqiface.Client, with a dry run HTTPClient.

func NewQueryReadClient added in v0.1.20

func NewQueryReadClient(qc QueryConfig) *Client

func (Client) Dataset

func (client Client) Dataset(ds string) bqiface.Dataset

Dataset creates a Dataset. TODO - understand how bqiface adapters/structs work, and make this return a Dataset that satisfies bqiface.Dataset interface?

func (Client) Query

func (client Client) Query(string) bqiface.Query

type ClientConfig added in v0.1.20

type ClientConfig struct {
	QueryConfig
}

ClientConfig contains configuration for injecting result and error values.

type CountingTransport

type CountingTransport struct {
	// contains filtered or unexported fields
}

CountingTransport counts calls, and returns OK and empty body. `count` field should only be accessed using atomic.Foobar

func DryRunClient

func DryRunClient() (*http.Client, *CountingTransport)

DryRunClient returns a client that just counts calls.

func (*CountingTransport) Count

func (ct *CountingTransport) Count() int32

Count returns the client call count.

func (*CountingTransport) Requests

func (ct *CountingTransport) Requests() []*http.Request

Requests returns the entire req from the last request

func (*CountingTransport) RoundTrip

func (ct *CountingTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface, logging the request, and the response body, (which may be json).

type Dataset

type Dataset struct {
	bqiface.Dataset
	// contains filtered or unexported fields
}

Dataset implements part of the bqiface.Dataset interface.

func (Dataset) Table

func (ds Dataset) Table(name string) bqiface.Table

Table implements the bqiface method.

type Job

type Job struct {
	bqiface.Job
}

Job implements parts of bqiface.Job to allow some very basic unit tests.

func (Job) Wait

func (j Job) Wait(context.Context) (*bigquery.JobStatus, error)

type Query

type Query struct {
	bqiface.Query
	// contains filtered or unexported fields
}

Query implements parts of bqiface.Query to allow some very basic unit tests.

func (Query) Read

func (Query) Run

func (q Query) Run(context.Context) (bqiface.Job, error)

func (Query) SetQueryConfig

func (q Query) SetQueryConfig(bqiface.QueryConfig)

type QueryConfig added in v0.1.20

type QueryConfig struct {
	ReadErr error
	RowIteratorConfig
}

QueryConfig contains configuration for injecting query results and error values.

type RowIterator

type RowIterator struct {
	bqiface.RowIterator
	// contains filtered or unexported fields
}

func (*RowIterator) Next

func (r *RowIterator) Next(dst interface{}) error

type RowIteratorConfig added in v0.1.20

type RowIteratorConfig struct {
	IterErr error
	Rows    []map[string]bigquery.Value
}

RowIteratorConfig contains configuration for injecting row iteration results and error values.

type Table

type Table struct {
	bqiface.Table
	// contains filtered or unexported fields
}

Table implements part of the bqiface.Table interface required for basic testing Other parts of the interface should be implemented as needed.

func (Table) Create

func (tbl Table) Create(ctx context.Context, meta *bigquery.TableMetadata) error

Create implements the bqiface method.

func (Table) DatasetID

func (tbl Table) DatasetID() string

DatasetID implements the bqiface method.

func (Table) FullyQualifiedName

func (tbl Table) FullyQualifiedName() string

FullyQualifiedName implements the bqiface method.

func (Table) Metadata

func (tbl Table) Metadata(ctx context.Context) (*bigquery.TableMetadata, error)

Metadata implements the bqiface method.

func (Table) ProjectID

func (tbl Table) ProjectID() string

ProjectID implements the bqiface method.

func (Table) TableID

func (tbl Table) TableID() string

TableID implements the bqiface method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL