Documentation
¶
Overview ¶
Package bigquery provides utilities for BigQuery operations including streaming inserts, table management, and query execution.
Index ¶
- Variables
- func SchemaFromStruct(v interface{}) (bigquery.Schema, error)
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) GetDataset() *bigquery.Dataset
- func (c *Client) GetTable(tableID string) *bigquery.Table
- func (c *Client) InsertRow(ctx context.Context, tableID string, row interface{}, schema bigquery.Schema) error
- func (c *Client) InsertRowAsync(tableID string, row interface{})
- func (c *Client) Query(ctx context.Context, sql string, params ...bigquery.QueryParameter) (*bigquery.RowIterator, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var StandardSchemas = struct { Telemetry bigquery.Schema Audit bigquery.Schema Analytics bigquery.Schema }{ Telemetry: bigquery.Schema{ {Name: "timestamp", Type: bigquery.TimestampFieldType, Required: true}, {Name: "user_id", Type: bigquery.StringFieldType}, {Name: "session_id", Type: bigquery.StringFieldType}, {Name: "event_type", Type: bigquery.StringFieldType, Required: true}, {Name: "event_data", Type: bigquery.JSONFieldType}, {Name: "duration_ms", Type: bigquery.IntegerFieldType}, {Name: "error", Type: bigquery.StringFieldType}, }, Audit: bigquery.Schema{ {Name: "timestamp", Type: bigquery.TimestampFieldType, Required: true}, {Name: "user_id", Type: bigquery.StringFieldType, Required: true}, {Name: "action", Type: bigquery.StringFieldType, Required: true}, {Name: "resource", Type: bigquery.StringFieldType}, {Name: "result", Type: bigquery.StringFieldType}, {Name: "ip_address", Type: bigquery.StringFieldType}, {Name: "user_agent", Type: bigquery.StringFieldType}, }, Analytics: bigquery.Schema{ {Name: "timestamp", Type: bigquery.TimestampFieldType, Required: true}, {Name: "metric_name", Type: bigquery.StringFieldType, Required: true}, {Name: "metric_value", Type: bigquery.FloatFieldType, Required: true}, {Name: "dimensions", Type: bigquery.JSONFieldType}, {Name: "user_id", Type: bigquery.StringFieldType}, {Name: "session_id", Type: bigquery.StringFieldType}, }, }
StandardSchemas provides common BigQuery schemas
Functions ¶
func SchemaFromStruct ¶
SchemaFromStruct generates a BigQuery schema from a struct The struct should have `bigquery` tags
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides efficient BigQuery operations with lazy table creation
func (*Client) GetDataset ¶
GetDataset returns the dataset reference
func (*Client) InsertRow ¶
func (c *Client) InsertRow(ctx context.Context, tableID string, row interface{}, schema bigquery.Schema) error
InsertRow inserts a single row into a BigQuery table
func (*Client) InsertRowAsync ¶
InsertRowAsync adds a row to the batch for async insertion
Click to show internal directories.
Click to hide internal directories.