bqiface

package
v0.0.0-...-1c9a4c6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 29

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

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

func AdaptClient(c *bigquery.Client) Client

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 DatasetIterator interface {
	SetListHidden(bool)
	SetFilter(string)
	SetProjectID(string)
	Next() (Dataset, error)
	PageInfo() *iterator.PageInfo
	// contains filtered or unexported methods
}

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 JobIterator interface {
	SetProjectID(string)
	SetAllUsers(bool)
	SetState(bigquery.State)
	Next() (Job, error)
	PageInfo() *iterator.PageInfo
	// contains filtered or unexported methods
}

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 RowIterator interface {
	SetStartIndex(uint64)
	Schema() bigquery.Schema
	TotalRows() uint64
	Next(interface{}) error
	PageInfo() *iterator.PageInfo
	// contains filtered or unexported methods
}

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
}

type TableIterator

type TableIterator interface {
	Next() (Table, error)
	PageInfo() *iterator.PageInfo
	// contains filtered or unexported methods
}

type Uploader

type Uploader interface {
	SetSkipInvalidRows(bool)
	SetIgnoreUnknownValues(bool)
	SetTableTemplateSuffix(string)
	Put(context.Context, interface{}) error
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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