Google API Go Client自动生成 Go 语言 API
Google API Go Client 可以自动生成 Google 的 Go 语言 API。
示例代码:
package main
import (
"container/list"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"math"
"math/rand"
"net/http"
"os"
"strconv"
"strings"
"time"
bigquery "google.golang.org/api/bigquery/v2"
storage "google.golang.org/api/storage/v1"
)
const (
GB = 1 << 30
MaxBackoff = 30000
BaseBackoff = 250
BackoffGrowthFactor = 1.8
BackoffGrowthDamper = 0.25
JobStatusDone = "DONE"
DatasetAlreadyExists = "Already Exists: Dataset"
TableWriteEmptyDisposition = "WRITE_EMPTY"
)
func init() {
scope := fmt.Sprintf("%s %s %s", bigquery.BigqueryScope,
storage.DevstorageRead_onlyScope,
"https://www.googleapis.com/auth/userinfo.profile")
registerDemo("bigquery", scope, bqMain)
}
评论
