formatter

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package formatter provides query formatters for export types supported by the stats pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationQueryFormatter

type AnnotationQueryFormatter struct {
	DateExpr string // BigQuery expression used to extract a row's date.
}

AnnotationQueryFormatter prepares export queries for annotation data exported by the stats pipeline.

func NewTCPINFOAnnotationQueryFormatter

func NewTCPINFOAnnotationQueryFormatter() *AnnotationQueryFormatter

NewTCPINFOAnnotationQueryFormatter creates a new AnnotationQueryFormatter.

func (*AnnotationQueryFormatter) Marshal

func (f *AnnotationQueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)

Marshal converts an export query row into a byte result suitable for writing to disk. For annotation export, the format is marshalled to annotation.Annotations and then to JSON.

func (*AnnotationQueryFormatter) Partition

func (f *AnnotationQueryFormatter) Partition(row map[string]bigquery.Value) string

Partition returns a date partition id based on a row returned by running the Partitions() query. The partition id can be used in query templates. The Annotation formatter conditions searches on the Date.

func (*AnnotationQueryFormatter) Partitions

func (f *AnnotationQueryFormatter) Partitions(source string) string

Partitions returns a bigquery query for listing all partitions for a given source table. The Annotation query partitions on `date`.

func (*AnnotationQueryFormatter) Source

func (f *AnnotationQueryFormatter) Source(project string, config config.Config, year int) string

Source returns a fully qualified bigquery table name. The year is ignored.

type HopAnnotation1QueryFormatter added in v0.3.1

type HopAnnotation1QueryFormatter struct{}

HopAnnotation1QueryFormatter prepares export queries for hopannotation1 data exported by the stats pipeline.

func NewTracerouteHopAnnotation1QueryFormatter added in v0.3.1

func NewTracerouteHopAnnotation1QueryFormatter() *HopAnnotation1QueryFormatter

NewTracerouteHopAnnotation1QueryFormatter creates a new HopAnnotation1QueryFormatter.

func (*HopAnnotation1QueryFormatter) Marshal added in v0.3.1

func (f *HopAnnotation1QueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)

Marshal converts an export query row into a byte result suitable for writing to disk. For hopannotation1 export, the format is marshalled to hopannotation.HopAnnotation1{}, and then to JSON.

func (*HopAnnotation1QueryFormatter) Partition added in v0.3.1

Partition returns a date partition id based on a row returned by running the Partitions() query. The partition id can be used in query templates. The HopAnnotation1 formatter condition searches on the Date.

func (*HopAnnotation1QueryFormatter) Partitions added in v0.3.1

func (f *HopAnnotation1QueryFormatter) Partitions(source string) string

Partitions returns a bigquery query for listing all partitions for a given source table. The HopAnnotation1 query partitions on `date`.

func (*HopAnnotation1QueryFormatter) Source added in v0.3.1

func (f *HopAnnotation1QueryFormatter) Source(project string, config config.Config, year int) string

Source returns a fully qualified bigquery table name. The year is ignored.

type StatsQueryFormatter

type StatsQueryFormatter struct{}

StatsQueryFormatter prepares export queries for statstics in the stats pipeline.

func NewStatsQueryFormatter

func NewStatsQueryFormatter() *StatsQueryFormatter

NewStatsQueryFormatter creates a new StatsQueryFormatter.

func (*StatsQueryFormatter) Marshal

func (f *StatsQueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)

Marshal converts an export query row into a byte result suitable for writing to disk. For stats pipeline export, the format is JSON.

func (*StatsQueryFormatter) Partition

func (f *StatsQueryFormatter) Partition(row map[string]bigquery.Value) string

Partition returns a shard partition id based on a row returned by running the Partitions() query. The partition id can be used in query templates.

func (*StatsQueryFormatter) Partitions

func (f *StatsQueryFormatter) Partitions(source string) string

Partitions returns a bigquery query for listing all partitions for a given source table.

func (*StatsQueryFormatter) Source

func (f *StatsQueryFormatter) Source(project string, config config.Config, year int) string

Source returns a fully qualified bigquery table name including a year suffix used by the stats pipeline.

Jump to

Keyboard shortcuts

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