gbigquery

package
v0.0.0-...-4cf80b3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: GPL-3.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const BigQueryTimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func CreateBigQuerySubscription

func CreateBigQuerySubscription(client *pubsub.Client, subscriptionName, table string, topic *pubsub.Topic) error

CreateBigQuerySubscription creates a Pub/Sub subscription that exports messages to BigQuery.

func CreateBigqueryTopic

func CreateBigqueryTopic(client *pubsub.Client, topicName string, schema *pubsub.SchemaConfig) (*pubsub.Topic, error)

func CreateProtoSchema

func CreateProtoSchema(client *pubsub.SchemaClient, schemaID, protoFile string) (*pubsub.SchemaConfig, error)

CreateProtoSchema creates a schema resource from a schema proto file.

func UpdateProtoSchema

func UpdateProtoSchema(client *pubsub.SchemaClient, name, revisionID, protoFile string) (*pubsub.SchemaConfig, error)

UpdateProtoSchema creates a schema resource from a schema proto file.

Types

type BQTable

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

func NewBQTable

func NewBQTable(client *bigquery.Client) *BQTable

func (BQTable) CheckOrCreateBigqueryTable

func (bqt BQTable) CheckOrCreateBigqueryTable(config *BQTableConfig, metaData *bigquery.TableMetadata) (*bigquery.TableMetadata, error)

type BQTableConfig

type BQTableConfig struct {
	Dataset string `json:"dataset"`
	Table   string `json:"table"`
	Schema  struct {
		Name     string `json:"name"`
		FilePath string `json:"filePath"`
		Revision string `json:"revision"`
	} `json:"schema"`
}

type Bucket

type Bucket struct {
	StartTime time.Time     `datastore:"Time"`
	Duration  time.Duration `datastore:"-"`
}

type BucketType

type BucketType struct {
	Interval   TimeInterval
	Multiplier int
}

func (BucketType) String

func (bt BucketType) String() string

type QueryInterval

type QueryInterval struct {
	Start time.Time `json:"start,omitempty"`
	End   time.Time `json:"end,omitempty"`
}

func (QueryInterval) BigQueryFormat

func (qi QueryInterval) BigQueryFormat() (string, string)

func (QueryInterval) Duration

func (qi QueryInterval) Duration() time.Duration

type TimeInterval

type TimeInterval string
const (
	HOUR TimeInterval = "HOUR"
	DAY  TimeInterval = "DAY"
)