Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientOptions ¶
type ClientOptions interface { // Service returns the client service Service() (*bigquery.Service, error) }
ClientOptions will construct the client service based on the options it was passed.
func WithConfigFile ¶
func WithConfigFile(path string) ClientOptions
WithConfigFile returns a ClientOptions that will construct the client service using a config file.
func WithJWTConfig ¶
func WithJWTConfig(config *jwt.Config) ClientOptions
WithJWTConfig returns a ClientOptions that will construct the client service using the given jwt config.
type Iter ¶
type Iter interface { // Next fetches the next row and fills the fields of the given // struct pointer with the columns of the row in appearance order. // For example, given: // struct { // Foo int // Bar int // } // // The row 1, 2 would result in struct{Foo: 1, Bar:2} // This method returns a boolean reporting if the operation was // successful. Next(interface{}) bool // Err returns the latest error that happened. Err() error }
Iter is a structure to loop through query results.
type Query ¶
type Query interface { // NextPage returns the next page of rows in the query resultset. It returns up // to the max results that were given to the query on its creation. Note that // BigQuery has a limit of 10MB, that is, when your page reaches the 10MB limit // it will yield and will not return the max number of results instead. NextPage() ([][]interface{}, error) // Iter returns an iterator to retrieve the query results. // Using this method sets the query in "iter" mode, that is, // the NextPage method can't be used after using Iter, but it // can be used before retrieving the iterator. Iter() Iter }
Query contains all the context of a query execution and has methods to retrieve the rows in pages. The Query instance can be seen as a cursor, it can't go back and it can't re-read the same page again. It is not thread safe and it is not intended to be.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service instances will be able to make queries. A Service is basically a Query constructor that holds the connection with BigQuery.
func New ¶
func New(clientOptions ClientOptions, config Config) (*Service, error)
New creates a new Service with the given client options and config.
func (*Service) Query ¶
Query creates a new query with the SQL sentence passed and a series of arguments. You can pass none, which means no additional parameters. The first parameter passed will be the start, that is, the offset in the resultset. The second parameter passed will be the max results allowed per page.