Help us shape the future of Go! Take the 2026 Go Developer Survey

dataset

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 Create

func Create(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error

func Delete

func Delete(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error

func Insert

func Insert(ctx context.Context, dsn, table string, items []interface{}) error

func Map added in v0.0.6

func Map(values []bigquery.Value, a ...any)
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 Query

func Query(ctx context.Context, query string, fn func(values []bigquery.Value)) error

func Shrink added in v0.0.6

func Shrink(message string) string
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

func Tables added in v0.0.6

func Tables(ctx context.Context, dsn string) ([]bigquery.TableMetadata, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Create

func (c *Client) Create(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, dsn string, meta []bigquery.TableMetadata) error

func (*Client) Insert

func (c *Client) Insert(ctx context.Context, dsn, table string, items []interface{}) error

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, fn func(values []bigquery.Value)) error

func (*Client) Tables added in v0.0.6

func (c *Client) Tables(ctx context.Context, dsn string) ([]bigquery.TableMetadata, error)

type Commit

type Commit struct {
	Owner      string    `bigquery:"owner"`
	Repository string    `bigquery:"repository"`
	Login      string    `bigquery:"login"`
	SHA        string    `bigquery:"sha"`
	Message    string    `bigquery:"message"`
	CreatedAt  time.Time `bigquery:"created_at"`
}

type Event

type Event struct {
	Owner      string    `bigquery:"owner"`
	Repository string    `bigquery:"repository"`
	Login      string    `bigquery:"login"`
	ID         string    `bigquery:"id"`
	Type       string    `bigquery:"type"`
	RawPayload string    `bigquery:"raw_payload"`
	CreatedAt  time.Time `bigquery:"created_at"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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