Documentation ¶
Overview ¶
Package bqiface provides a set of interfaces for the types in cloud.google.com/go/bigquery. These can be used to create mocks or other test doubles. The package also provides adapters to enable the types of the bigquery package to implement these interfaces.
We do not recommend using mocks for most testing. Please read https://testing.googleblog.com/2013/05/testing-on-toilet-dont-overuse-mocks.html.
Note: This package is in alpha. Some backwards-incompatible changes may occur.
You must embed these interfaces to implement them:
type ClientMock struct { bqiface.Client ... }
This ensures that your implementations will not break when methods are added to the interfaces.
Index ¶
- type AccessEntry
- type Client
- type Copier
- type CopyConfig
- type Dataset
- type DatasetIterator
- type DatasetMetadata
- type DatasetMetadataToUpdate
- type ExtractConfig
- type Extractor
- type Job
- type JobIterator
- type LoadConfig
- type Loader
- type Query
- type QueryConfig
- type RowIterator
- type Table
- type TableIterator
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessEntry ¶
type AccessEntry struct { bigquery.AccessEntry View Table // shadows bigquery.AccessEntry's field }
type Client ¶
type Client interface { Location() string SetLocation(string) Close() error Dataset(string) Dataset DatasetInProject(string, string) Dataset Datasets(context.Context) DatasetIterator DatasetsInProject(context.Context, string) DatasetIterator Query(string) Query JobFromID(context.Context, string) (Job, error) JobFromIDLocation(context.Context, string, string) (Job, error) Jobs(context.Context) JobIterator // contains filtered or unexported methods }
func AdaptClient ¶
type Copier ¶
type Copier interface { JobIDConfig() *bigquery.JobIDConfig SetCopyConfig(CopyConfig) Run(context.Context) (Job, error) // contains filtered or unexported methods }
type CopyConfig ¶
type CopyConfig struct { bigquery.CopyConfig Srcs []Table // shadows bigquery.CopyConfig's field Dst Table // shadows bigquery.CopyConfig's field }
type Dataset ¶
type Dataset interface { ProjectID() string DatasetID() string Create(context.Context, *DatasetMetadata) error Delete(context.Context) error DeleteWithContents(context.Context) error Metadata(context.Context) (*DatasetMetadata, error) Update(context.Context, DatasetMetadataToUpdate, string) (*DatasetMetadata, error) Table(string) Table Tables(context.Context) TableIterator // contains filtered or unexported methods }
type DatasetIterator ¶
type DatasetMetadata ¶
type DatasetMetadata struct { bigquery.DatasetMetadata Access []*AccessEntry // shadows bigquery.DatasetMetadata's field }
type DatasetMetadataToUpdate ¶
type DatasetMetadataToUpdate struct { bigquery.DatasetMetadataToUpdate Access []*AccessEntry // shadows bigquery.DatasetMetadataToUpdate's field }
type ExtractConfig ¶
type ExtractConfig struct { bigquery.ExtractConfig Src Table // shadows bigquery.ExtractConfig's field }
type Extractor ¶
type Extractor interface { JobIDConfig() *bigquery.JobIDConfig SetExtractConfig(ExtractConfig) Run(context.Context) (Job, error) // contains filtered or unexported methods }
type Job ¶
type Job interface { ID() string Location() string Config() (bigquery.JobConfig, error) Status(context.Context) (*bigquery.JobStatus, error) LastStatus() *bigquery.JobStatus Cancel(context.Context) error Wait(context.Context) (*bigquery.JobStatus, error) Read(context.Context) (RowIterator, error) // contains filtered or unexported methods }
type JobIterator ¶
type LoadConfig ¶
type LoadConfig struct { bigquery.LoadConfig Dst Table // shadows bigquery.LoadConfig's field }
type Loader ¶
type Loader interface { JobIDConfig() *bigquery.JobIDConfig SetLoadConfig(LoadConfig) Run(context.Context) (Job, error) // contains filtered or unexported methods }
type Query ¶
type Query interface { JobIDConfig() *bigquery.JobIDConfig SetQueryConfig(QueryConfig) Run(context.Context) (Job, error) Read(context.Context) (RowIterator, error) // contains filtered or unexported methods }
type QueryConfig ¶
type QueryConfig struct { bigquery.QueryConfig Dst Table // shaodws bigquery.QueryConfig's field }
type RowIterator ¶
type Table ¶
type Table interface { CopierFrom(...Table) Copier Create(context.Context, *bigquery.TableMetadata) error DatasetID() string Delete(context.Context) error ExtractorTo(dst *bigquery.GCSReference) Extractor FullyQualifiedName() string LoaderFrom(bigquery.LoadSource) Loader Metadata(context.Context) (*bigquery.TableMetadata, error) ProjectID() string Read(ctx context.Context) RowIterator TableID() string Update(context.Context, bigquery.TableMetadataToUpdate, string) (*bigquery.TableMetadata, error) Uploader() Uploader // contains filtered or unexported methods }