Documentation ¶
Index ¶
- Variables
- func Create(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error
- func Delete(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error
- func Insert(ctx context.Context, dsn, table string, items []interface{}) error
- func Map(values []bigquery.Value, a ...any)
- func Query(ctx context.Context, query string, fn func(values []bigquery.Value)) error
- func Shrink(message string) string
- func Tables(ctx context.Context, dsn string) ([]bigquery.TableMetadata, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Create(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error
- func (c *Client) Delete(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error
- func (c *Client) Insert(ctx context.Context, dsn, table string, items []interface{}) error
- func (c *Client) Query(ctx context.Context, query string, fn func(values []bigquery.Value)) error
- func (c *Client) Tables(ctx context.Context, dsn string) ([]bigquery.TableMetadata, error)
- type Commit
- type Event
- type Incident
- type PullReq
- type PullReqCommit
- type PushEvent
- type Release
- type ReleasesCommit
- type WorkflowJob
- type WorkflowRun
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Commits = bigquery.TableMetadata{ Name: "commits", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "sha", Type: bigquery.StringFieldType, Required: true}, {Name: "message", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var Events = bigquery.TableMetadata{ Name: "events", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "id", Type: bigquery.StringFieldType, Required: true}, {Name: "type", Type: bigquery.StringFieldType, Required: true}, {Name: "raw_payload", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var EventsPush = bigquery.TableMetadata{ Name: "events_push", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "id", Type: bigquery.StringFieldType, Required: true}, {Name: "type", Type: bigquery.StringFieldType, Required: true}, {Name: "head_sha", Type: bigquery.StringFieldType, Required: true}, {Name: "sha", Type: bigquery.StringFieldType, Required: true}, {Name: "message", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var Incidents = bigquery.TableMetadata{ Name: "incidents", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "inserted_at", }, Schema: bigquery.Schema{ {Name: "id", Type: bigquery.StringFieldType, Required: true}, {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "description", Type: bigquery.StringFieldType, Required: true}, {Name: "sha", Type: bigquery.StringFieldType, Required: true}, {Name: "inserted_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "resolved_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var PullReqCommits = bigquery.TableMetadata{ Name: "pullreqs_commits", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "number", Type: bigquery.IntegerFieldType, Required: true}, {Name: "sha", Type: bigquery.StringFieldType, Required: true}, {Name: "message", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var PullReqs = bigquery.TableMetadata{ Name: "pullreqs", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "number", Type: bigquery.IntegerFieldType, Required: true}, {Name: "title", Type: bigquery.StringFieldType, Required: true}, {Name: "state", Type: bigquery.StringFieldType, Required: true}, {Name: "merge_commit_sha", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "updated_at", Type: bigquery.TimestampFieldType}, {Name: "merged_at", Type: bigquery.TimestampFieldType}, {Name: "closed_at", Type: bigquery.TimestampFieldType}, }, }
View Source
var Releases = bigquery.TableMetadata{ Name: "releases", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "tagged_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "name", Type: bigquery.StringFieldType, Required: true}, {Name: "target_commitish", Type: bigquery.StringFieldType, Required: true}, {Name: "tag_name", Type: bigquery.StringFieldType, Required: true}, {Name: "tag_sha", Type: bigquery.StringFieldType, Required: true}, {Name: "tagged_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "published_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var ReleasesCommits = bigquery.TableMetadata{ Name: "releases_commits", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "login", Type: bigquery.StringFieldType, Required: true}, {Name: "release_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "tag_name", Type: bigquery.StringFieldType, Required: true}, {Name: "tag_sha", Type: bigquery.StringFieldType, Required: true}, {Name: "sha", Type: bigquery.StringFieldType, Required: true}, {Name: "message", Type: bigquery.StringFieldType, Required: true}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "tagged_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "published_at", Type: bigquery.TimestampFieldType, Required: true}, }, }
View Source
var WorkflowJobs = bigquery.TableMetadata{ Name: "workflow_jobs", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "started_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "workflow_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "workflow_name", Type: bigquery.StringFieldType, Required: true}, {Name: "run_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "run_number", Type: bigquery.IntegerFieldType, Required: true}, {Name: "job_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "job_name", Type: bigquery.StringFieldType, Required: true}, {Name: "status", Type: bigquery.StringFieldType, Required: true}, {Name: "conclusion", Type: bigquery.StringFieldType}, {Name: "started_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "completed_at", Type: bigquery.TimestampFieldType}, }, }
View Source
var WorkflowRuns = bigquery.TableMetadata{ Name: "workflow_runs", TimePartitioning: &bigquery.TimePartitioning{ Type: bigquery.MonthPartitioningType, Field: "created_at", }, Schema: bigquery.Schema{ {Name: "owner", Type: bigquery.StringFieldType, Required: true}, {Name: "repository", Type: bigquery.StringFieldType, Required: true}, {Name: "workflow_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "workflow_name", Type: bigquery.StringFieldType, Required: true}, {Name: "run_id", Type: bigquery.IntegerFieldType, Required: true}, {Name: "run_number", Type: bigquery.IntegerFieldType, Required: true}, {Name: "head_sha", Type: bigquery.StringFieldType, Required: true}, {Name: "status", Type: bigquery.StringFieldType, Required: true}, {Name: "conclusion", Type: bigquery.StringFieldType}, {Name: "created_at", Type: bigquery.TimestampFieldType, Required: true}, {Name: "updated_at", Type: bigquery.TimestampFieldType}, }, }
Functions ¶
func Map ¶ added in v0.0.6
Example ¶
package main import ( "fmt" "time" "cloud.google.com/go/bigquery" "github.com/itsubaki/fourkeys/dataset" ) func main() { values := []bigquery.Value{ "foo", int64(1234), } var a string var b int64 dataset.Map(values, &a, &b) fmt.Printf("[%v, %v]\n", a, b) var c, d, e int64 dataset.Map(values, &c, &d, &e) fmt.Printf("[%v, %v, %v]\n", c, d, e) var t time.Time dataset.Map([]bigquery.Value{time.Date(2014, time.December, 31, 12, 13, 24, 0, time.UTC)}, &t) fmt.Printf("%v\n", t) }
Output: [foo, 1234] [0, 0, 0] 2014-12-31 12:13:24 +0000 UTC
func Shrink ¶ added in v0.0.6
Example ¶
package main import ( "fmt" "github.com/itsubaki/fourkeys/dataset" ) func main() { m := "kp938C2ax2j5cLWMN2eNxTwAVXGKsxn8mPWVxnmQm4Deun9XB5rkMsnJaTGWEdK9" fmt.Printf("len(m)=%v\n", len(m)) fmt.Println(dataset.Shrink(m)) fmt.Println(dataset.Shrink(m + "aaaa")) fmt.Println(dataset.Shrink("kp938C2ax2j5cLWMN2eNxTwAVXGKsxn8mPWVxnmQm4Deun9XB5rkMsnJaTGWEdK")) }
Output: len(m)=64 kp938C2ax2j5cLWMN2eNxTwAVXGKsxn8mPWVxnmQm4Deun9XB5rkMsnJaTGWEdK9 kp938C2ax2j5cLWMN2eNxTwAVXGKsxn8mPWVxnmQm4Deun9XB5rkMsnJaTGWEdK9 kp938C2ax2j5cLWMN2eNxTwAVXGKsxn8mPWVxnmQm4Deun9XB5rkMsnJaTGWEdK
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type Incident ¶
type Incident struct { ID string `bigquery:"id" json:"id"` Owner string `bigquery:"owner" json:"owner"` Repository string `bigquery:"repository" json:"repository"` Description string `bigquery:"description" json:"description"` SHA string `bigquery:"sha" json:"sha"` InsertedAt time.Time `bigquery:"inserted_at" json:"inserted_at"` ResolvedAt time.Time `bigquery:"resolved_at" json:"resolved_at"` }
type PullReq ¶
type PullReq struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` Login string `bigquery:"login"` ID int64 `bigquery:"id"` Number int64 `bigquery:"number"` Title string `bigquery:"title"` State string `bigquery:"state"` MergeCommitSHA string `bigquery:"merge_commit_sha"` CreatedAt time.Time `bigquery:"created_at"` UpdatedAt time.Time `bigquery:"updated_at"` MergedAt time.Time `bigquery:"merged_at"` ClosedAt time.Time `bigquery:"closed_at"` }
type PullReqCommit ¶
type PullReqCommit struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` Login string `bigquery:"login"` ID int64 `bigquery:"id"` Number int64 `bigquery:"number"` SHA string `bigquery:"sha"` Message string `bigquery:"message"` CreatedAt time.Time `bigquery:"created_at"` }
type PushEvent ¶
type PushEvent struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` Login string `bigquery:"login"` ID string `bigquery:"id"` Type string `bigquery:"type"` HeadSHA string `bigquery:"head_sha"` SHA string `bigquery:"sha"` Message string `bigquery:"message"` CreatedAt time.Time `bigquery:"created_at"` }
type Release ¶
type Release struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` Login string `bigquery:"login"` ID int64 `bigquery:"id"` TargetCommitish string `bigquery:"target_commitish"` TagName string `bigquery:"tag_name"` TagSHA string `bigquery:"tag_sha"` Name string `bigquery:"name"` TaggedAt time.Time `bigquery:"tagged_at"` PublishedAt time.Time `bigquery:"published_at"` }
type ReleasesCommit ¶ added in v0.0.5
type ReleasesCommit struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` Login string `bigquery:"login"` ReleaseID int64 `bigquery:"release_id"` TagName string `bigquery:"tag_name"` TagSHA string `bigquery:"tag_sha"` SHA string `bigquery:"sha"` CreatedAt time.Time `bigquery:"created_at"` TaggedAt time.Time `bigquery:"tagged_at"` PublishedAt time.Time `bigquery:"published_at"` Message string `bigquery:"message"` }
type WorkflowJob ¶
type WorkflowJob struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` WorkflowID int64 `bigquery:"workflow_id"` WorkflowName string `bigquery:"workflow_name"` RunID int64 `bigquery:"run_id"` RunNumber int64 `bigquery:"run_number"` JobID int64 `bigquery:"job_id"` JobName string `bigquery:"job_name"` Status string `bigquery:"status"` Conclusion string `bigquery:"conclusion"` StartedAt time.Time `bigquery:"started_at"` CompletedAt time.Time `bigquery:"completed_at"` }
type WorkflowRun ¶
type WorkflowRun struct { Owner string `bigquery:"owner"` Repository string `bigquery:"repository"` WorkflowID int64 `bigquery:"workflow_id"` WorkflowName string `bigquery:"workflow_name"` RunID int64 `bigquery:"run_id"` RunNumber int64 `bigquery:"run_number"` HeadSHA string `bigquery:"head_sha"` Status string `bigquery:"status"` Conclusion string `bigquery:"conclusion"` CreatedAt time.Time `bigquery:"created_at"` UpdatedAt time.Time `bigquery:"updated_at"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.