Documentation ¶
Overview ¶
Package formatter provides query formatters for export types supported by the stats pipeline.
Index ¶
- type AnnotationQueryFormatter
- func (f *AnnotationQueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)
- func (f *AnnotationQueryFormatter) Partition(row map[string]bigquery.Value) string
- func (f *AnnotationQueryFormatter) Partitions(source string) string
- func (f *AnnotationQueryFormatter) Source(project string, config config.Config, year int) string
- type HopAnnotation1QueryFormatter
- func (f *HopAnnotation1QueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)
- func (f *HopAnnotation1QueryFormatter) Partition(row map[string]bigquery.Value) string
- func (f *HopAnnotation1QueryFormatter) Partitions(source string) string
- func (f *HopAnnotation1QueryFormatter) Source(project string, config config.Config, year int) string
- type StatsQueryFormatter
- func (f *StatsQueryFormatter) Marshal(rows []map[string]bigquery.Value) ([]byte, error)
- func (f *StatsQueryFormatter) Partition(row map[string]bigquery.Value) string
- func (f *StatsQueryFormatter) Partitions(source string) string
- func (f *StatsQueryFormatter) Source(project string, config config.Config, year int) string
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 ¶
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`.
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
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
func (f *HopAnnotation1QueryFormatter) 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 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`.
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 ¶
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.