bigquery

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TagName is used for struct tag which defining table column name
	TagName = "bigquery"
)

Functions

This section is empty.

Types

type BigQuery added in v0.6.0

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

BigQuery is BigQuery API client..

func New added in v0.6.0

func New(conf config.Config, projectID string) (*BigQuery, error)

New returns initialized BigQuery.

func (*BigQuery) CancelJob added in v0.6.0

func (b *BigQuery) CancelJob(jobID string) (*SDK.JobCancelResponse, error)

CancelJob performes Jobs.Cancel operation. Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs. For more information, see pricing.

func (*BigQuery) CreateDataset added in v0.6.0

func (b *BigQuery) CreateDataset(dataset *SDK.Dataset) (*Dataset, error)

CreateDataset performes Datasets.Insert operation. Creates a new empty dataset.

func (*BigQuery) CreateTable added in v0.6.0

func (b *BigQuery) CreateTable(datasetID string, tbl *SDK.Table) (*Table, error)

CreateTable performes Table.Insert operation. Creates a new, empty table in the dataset.

func (*BigQuery) DatasetAPI added in v0.6.0

func (b *BigQuery) DatasetAPI(datasetID string) *DatasetAPI

DatasetAPI returns initialized DatasetAPI.

func (*BigQuery) DeleteDataset added in v0.6.0

func (b *BigQuery) DeleteDataset(datasetID string) error

DeleteDataset performes Datasets.Delete operation. Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.

func (*BigQuery) DropTable added in v0.6.0

func (b *BigQuery) DropTable(datasetID string, tableID string) error

DropTable performes Tables.Delete operation. Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.

func (*BigQuery) Errorf added in v0.6.0

func (b *BigQuery) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*BigQuery) GetDataset added in v0.6.0

func (b *BigQuery) GetDataset(datasetID string) (*Dataset, error)

GetDataset performes Datasets.Get operation. Returns the dataset specified by datasetID.

func (*BigQuery) GetJob added in v0.6.0

func (b *BigQuery) GetJob(jobID string) (*SDK.Job, error)

GetJob performes Jobs.Get operation. Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.

func (*BigQuery) GetQueryResults added in v0.6.0

func (b *BigQuery) GetQueryResults(jobID string) (*SDK.GetQueryResultsResponse, error)

GetQueryResults performes Jobs.GetQueryResults operation. Retrieves the results of a query job.

func (*BigQuery) GetTable added in v0.6.0

func (b *BigQuery) GetTable(datasetID string, tableID string) (*Table, error)

GetTable performes Tables.Get operation. Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.

func (*BigQuery) GetTableData added in v0.6.0

func (b *BigQuery) GetTableData(datasetID string, tableID string) (*SDK.TableDataList, error)

GetTableData performes Tabledata.List operation. Retrieves table data from a specified set of rows. Requires the READER dataset role.

func (*BigQuery) InsertAll added in v0.6.0

func (b *BigQuery) InsertAll(datasetID string, tableID string, rows *SDK.TableDataInsertAllRequest) (*SDK.TableDataInsertAllResponse, error)

InsertAll performes Tabledata.InsertAll operation. Streams data into BigQuery one record at a time without needing to run a load job. For more information, see streaming data into BigQuery.

func (*BigQuery) ListDatasets added in v0.6.0

func (b *BigQuery) ListDatasets() (*SDK.DatasetList, error)

ListDatasets performes Datasets.List operation. Lists all datasets in the specified project to which you have been granted the READER dataset role.

func (*BigQuery) ListJobs added in v0.6.0

func (b *BigQuery) ListJobs() (*SDK.JobList, error)

ListJobs performes Jobs.List operation. Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.

func (*BigQuery) ListTables added in v0.6.0

func (b *BigQuery) ListTables(datasetID string, tableID string) (*SDK.TableList, error)

ListTables performes Tables.List operation. Lists all tables in the specified dataset. Requires the READER dataset role.

func (*BigQuery) PatchDataset added in v0.6.0

func (b *BigQuery) PatchDataset(datasetID string, dataset *SDK.Dataset) (*Dataset, error)

PatchDataset performes Datasets.Patch operation. Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.

func (*BigQuery) PatchTable added in v0.6.0

func (b *BigQuery) PatchTable(datasetID string, tableID string, tbl *SDK.Table) (*Table, error)

PatchTable performes Tables.Patch operation. Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.

func (*BigQuery) Query added in v0.8.1

func (b *BigQuery) Query(opt QueryOption) (*QueryResponse, error)

func (*BigQuery) RunJob added in v0.6.0

func (b *BigQuery) RunJob(job *SDK.Job) (*SDK.Job, error)

RunJob performes Jobs.Insert operation. Starts a new asynchronous job. Requires the Can View project role.

func (*BigQuery) RunQuery added in v0.6.0

func (b *BigQuery) RunQuery(query *SDK.QueryRequest) (*SDK.QueryResponse, error)

RunQuery performes Jobs.Query operation. Runs a BigQuery SQL query and returns results if the query completes within a specified timeout.

func (*BigQuery) SetLogger added in v0.6.0

func (b *BigQuery) SetLogger(logger log.Logger)

SetLogger sets internal API logger.

func (*BigQuery) UpdateDataset added in v0.6.0

func (b *BigQuery) UpdateDataset(datasetID string, dataset *SDK.Dataset) (*Dataset, error)

UpdateDataset performes Datasets.Update operation. Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.

func (*BigQuery) UpdateTable added in v0.6.0

func (b *BigQuery) UpdateTable(datasetID string, tableID string, tbl *SDK.Table) (*Table, error)

UpdateTable performes Tables.Update operation. Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.

type Dataset

type Dataset struct {
	*SDK.Dataset
}

Dataset represents SDK.Dataset.

type DatasetAPI added in v0.6.0

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

DatasetAPI is bigquery dataset client.

func NewDatasetAPI added in v0.6.0

func NewDatasetAPI(conf config.Config, projectID, datasetID string) (*DatasetAPI, error)

NewDatasetAPI returns initialized DatasetAPI

func (*DatasetAPI) CreateTable added in v0.6.0

func (ds *DatasetAPI) CreateTable(tableID string, schemaStruct interface{}) error

CreateTable creates the table with schema defined from given struct (*Deprecated)

func (*DatasetAPI) Delete added in v0.6.0

func (ds *DatasetAPI) Delete() error

Delete deletes the dataset.

func (*DatasetAPI) Get added in v0.6.0

func (ds *DatasetAPI) Get() (*Dataset, error)

Get gets the dataset.

func (*DatasetAPI) InsertAll added in v0.6.0

func (ds *DatasetAPI) InsertAll(tableID string, data interface{}) error

InsertAll appends all of map data by using InsertAll api (*Deprecated)

func (*DatasetAPI) TableAPI added in v0.6.0

func (ds *DatasetAPI) TableAPI(tableID string) *TableAPI

TableAPI returns initialized TableAPI.

type QueryOption added in v0.8.1

type QueryOption struct {
	// required
	SQL string

	// optional
	ProjectID     string
	DatasetID     string
	DryRun        bool
	Location      string
	MaxResults    int64
	ParameterMode string
	TimeoutMs     int64
	UseLegacySql  bool
	NoQueryCache  bool
}

func (QueryOption) ToRequest added in v0.8.1

func (o QueryOption) ToRequest() *SDK.QueryRequest

type QueryResponse added in v0.8.1

type QueryResponse struct {
	*SDK.QueryResponse
}

func (*QueryResponse) ToMap added in v0.8.1

func (r *QueryResponse) ToMap() ([]map[string]interface{}, error)

type Table added in v0.6.0

type Table struct {
	*SDK.Table
}

Table represents SDK.Table.

type TableAPI added in v0.6.0

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

TableAPI is bigquery table client.

func NewTableAPI added in v0.6.0

func NewTableAPI(conf config.Config, projectID, datasetID, tableID string) (*TableAPI, error)

NewTableAPI returns initialized TableAPI

func (*TableAPI) Create added in v0.6.0

func (t *TableAPI) Create(schemaStruct interface{}) error

Create creates the table with schema defined from given struct.

func (*TableAPI) Drop added in v0.6.0

func (t *TableAPI) Drop() error

Drop deletes the table.

func (*TableAPI) Get added in v0.6.0

func (t *TableAPI) Get() (*Table, error)

Get gets the table.

func (*TableAPI) InsertAll added in v0.6.0

func (t *TableAPI) InsertAll(data interface{}) error

InsertAll appends all of map data by using InsertAll api

func (*TableAPI) IsExist added in v0.6.0

func (t *TableAPI) IsExist() (bool, error)

IsExist checks if the table is exists in BQ.

Jump to

Keyboard shortcuts

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