bigquery

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BigQuery_SCHEMA_QUERY = "SELECT * FROM %s LIMIT 1"
	BigQuery_TABLES_QUERY = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '%s'"
)

Variables

View Source
var GOOGLE_APPLICATION_CREDENTIALS = "GOOGLE_APPLICATION_CREDENTIALS"

Functions

func NewBigQuery

func NewBigQuery(client *sql.DB) (types.ISQL, error)

NewBigQuery creates a new instance of BigQuery with the provided client. It returns an instance of types.ISQL and an error.

func NewBigQueryWithConfig

func NewBigQueryWithConfig(cfg *config.Config) (types.ISQL, error)

NewBigQueryWithConfig creates a new instance of BigQuery with the provided configuration. It returns an instance of types.ISQL and an error.

Types

type BigQuery

type BigQuery struct {
	Client *sql.DB
	Config *config.Config
}

The BigQuery struct is responsible for holding the BigQuery client and configuration.

func (*BigQuery) Execute

func (b *BigQuery) Execute(query string) ([]byte, error)

Execute executes a query on BigQuery. It takes a query string as input and returns the result as a byte slice and an error.

func (*BigQuery) GenerateCreateTableQuery

func (b *BigQuery) GenerateCreateTableQuery(table types.Table) string

GenerateCreateTableQuery generates a CREATE TABLE query for BigQuery.

func (*BigQuery) Schema

func (b *BigQuery) Schema(table string) (types.Table, error)

this function extarcts the schema of a table in BigQuery. It takes table name as input and returns a Table struct and an error.

func (*BigQuery) Tables

func (b *BigQuery) Tables(dataset string) ([]string, error)

Tables returns a list of tables in a dataset. It takes a dataset name as input and returns a slice of strings and an error.

Jump to

Keyboard shortcuts

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