mbigquery

package
v0.0.0-...-c20f884 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mbigquery implements connecting to Google's BigQuery service and simplifying a number of interactions with it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigQuery

type BigQuery struct {
	*bigquery.Client
	// contains filtered or unexported fields
}

BigQuery is a wrapper around a bigquery client providing more functionality.

func WithBigQuery

func WithBigQuery(parent context.Context, gce *mdb.GCE) (context.Context, *BigQuery)

WithBigQuery returns a BigQuery instance which will be initialized and configured when the start event is triggered on the returned (see mrun.Start). The BigQuery instance will have Close called on it when the stop event is triggered on the returned Context (see mrun.Stop).

gce is optional and can be passed in if there's an existing gce object which should be used, otherwise a new one will be created with mdb.MGCE.

func (*BigQuery) Table

func (bq *BigQuery) Table(
	ctx context.Context,
	dataset, tableName string,
	schemaObj interface{},
) (
	*bigquery.Table, *bigquery.Uploader, error,
)

Table initializes and returns the table instance with the given dataset and schema information. This method caches the Table/Uploader instances it returns, so multiple calls with the same dataset/tableName will only actually create those instances on the first call.

type Time

type Time struct {
	time.Time
}

Time wraps a time.Time object and provides marshaling/unmarshaling for bigquery's time format.

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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