Bq-client is a client for Google bigquery with golang. This works on progress.
Current API Documents:
go get github.com/sk88ks/bq-client
To create a new client,
import(
"fmt"
bqc "github.com/sk88ks/bq-client"
)
type Response struct {
....
}
const (
keyPath = "pathToKeyPemfile"
accountEmail = "your account email"
gcpProject = "your gcp projact ID"
bqDataset = "your data set name"
)
func main() {
key, err := bqc.GetPrivateKeyByPEM(keyPath)
if err != nil {
return err
}
bqClient := bqc.New(accountEmail, key, "")
bqClient.Dataset(gcpProject, bqDataset)
var res []Response
queryString := "SELECT * FROM test.test_table WHERE num > 0"
err = bqClient.Query(query).Execute(&res)
fmt.Println(res)
}