bigquery_aggregator

package
v0.0.0-...-b28e40e Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bigquery_aggregator uploads data to BigQuery. State is stored in Datastore to prevent duplicate uploads. The aggregator is threadsafe, using Datastore transactions to manage ownership of each uploaded item.

This API is unstable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator aggregates data into a BigQuery table. It is illegal to construct an instance directly. Use the New constructor instead.

func New

func New(namespace, dataset, table string, ds *datastore.Client, bq *bigquery.Client) *Aggregator

New returns an aggregator configured with the given namespace and datastore backend. The datastore is used as a lockservice for preventing duplicate rows. If namespace is empty, then the global namespace will be used.

func (*Aggregator) MatchExists

func (a *Aggregator) MatchExists(ctx context.Context, r region.Region, id int64) (bool, error)

MatchExists returns true if the match ID for the given region is already stored.

func (*Aggregator) SaveMatches

func (a *Aggregator) SaveMatches(ctx context.Context, matches []data_aggregation.Match) error

SaveMatches stores the match from the given region. Returns whether the function stored the match. If not, and there was no error, then the match was already cached.

Jump to

Keyboard shortcuts

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