Documentation ¶
Overview ¶
Package bigquery contains a client to query BigQuery quicker & safely.
Index ¶
- Constants
- type Client
- type Condition
- type Dataset
- type Inserter
- type Pager
- type Query
- func (q *Query) Checksum(dataset Dataset, pageSize int32) uint32
- func (q *Query) Clone() *Query
- func (q *Query) Filter(filter string, value interface{}) *Query
- func (q *Query) FilterCond(cond *Condition) *Query
- func (q *Query) Limit(limit int64) *Query
- func (q *Query) OrderBy(column string) *Query
- func (q *Query) String() string
- type QueryOption
- type StructSaver
- type Table
Constants ¶
const ( // DefaultPageSize if not specified. DefaultPageSize = 50 // MaxPageSize we can ask for in the pagination. MaxPageSize = 500 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.55.0
type Client struct {
// contains filtered or unexported fields
}
Client holds a connection to the BigQuery service.
type Condition ¶ added in v1.55.0
type Condition struct {
// contains filtered or unexported fields
}
Condition is a filter condition of a query.
func ConditionAnd ¶ added in v1.55.0
func ConditionAnd() *Condition
ConditionAnd builds a new condition where all the members are merged with the AND operator.
func ConditionOr ¶ added in v1.55.0
func ConditionOr() *Condition
ConditionAnd builds a new condition where all the members are merged with the OR operator.
func (*Condition) Filter ¶ added in v1.55.0
Filter builds a new condition adding the filter we specify. Examples:
.Filter("foo", 3) .Filter("foo >", 3) .Filter("foo BETWEEN ? AND ?", 3, 4)
func (*Condition) FilterCond ¶ added in v1.55.0
FilterCond builds a new condition adding the new child condition we specify here. Examples:
cond := ConditionOr() cond = cond.Filter("foo", 3) cond = cond.Filter("bar", 4) .FilterCond(cond)
type Pager ¶ added in v1.55.0
type Pager struct { // NextPageToken is the token of the next page, or empty if there is no more // results. It is filled after the call to Fetch. NextPageToken string // TotalSize is the total number of results the job has returned. It is filled // after the call to Fetch. TotalSize int32 // contains filtered or unexported fields }
Pager helps when retrieving paginated results.
type Query ¶ added in v1.55.0
type Query struct {
// contains filtered or unexported fields
}
Query is a SQL builder for BigQuery queries.
func NewQuery ¶ added in v1.55.0
func NewQuery(table Table, opts ...QueryOption) *Query
NewQuery builds a new query to the table.
There is a required option for all tables: Select(...) For partitioned tables there is another required option: WithPartitionRange(...)
func (*Query) Checksum ¶ added in v1.55.0
Checksum returns a checksum of the filters, conditions, table name, ... and other internal data of the collection that identifies it. It won't include the columns, so you can add or remove them without busting the checksums.
func (*Query) Filter ¶ added in v1.55.0
Filter adds a new WHERE condition directly to the query. All the query conditions will be combined with the AND operator.
func (*Query) FilterCond ¶ added in v1.55.0
FilterCond adds a new child condition directly to the query. All the children query conditions will be combined with the AND operator.
type QueryOption ¶ added in v1.55.0
type QueryOption func(q *Query)
QueryOption are options we can configure in a query.
func Select ¶ added in v1.55.0
func Select(cols ...string) QueryOption
Select the columns to return in the query. This is a required option in all queries because there is no sane default to not consume BigQuery quota.
func WithPartitionRange ¶ added in v1.55.0
func WithPartitionRange(start, end time.Time) QueryOption
WithPartitionRange controls the range of partitions we want to query in a table to save money not processing unnecessary data.
The range is according to API standards, that is: [start, end)
type StructSaver ¶
type StructSaver = bigquery.StructSaver
StructSaver helps with struct insertion in a table.