bigquery

package
v1.0.2003 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package bigquery is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Init(ctx context.Context) (err error)
	CheckIfDatasetExists(ctx context.Context) (exists bool)
	CheckIfTableExists(ctx context.Context, table string) (exists bool)
	CreateTable(ctx context.Context, table string, typeForSchema interface{}, partitionField string, waitReady bool) (err error)
	UpdateTableSchema(ctx context.Context, table string, typeForSchema interface{}) (err error)
	InsertBuildEvent(ctx context.Context, event PipelineBuildEvent) (err error)
	InsertReleaseEvent(ctx context.Context, event PipelineReleaseEvent) (err error)
}

Client is the interface for connecting to bigquery

func NewClient

func NewClient(config *api.APIConfig, bigqueryClient *bigquery.Client) Client

NewClient returns new bigquery.Client

func NewLoggingClient

func NewLoggingClient(c Client) Client

func NewMetricsClient

func NewMetricsClient(c Client, requestCount metrics.Counter, requestLatency metrics.Histogram) Client

NewMetricsClient returns a new instance of a metrics Client.

func NewTracingClient

func NewTracingClient(c Client) Client

NewTracingClient returns a new instance of a tracing Client.

type Job

type Job struct {
	JobID  int `bigquery:"job_id"`
	Stages []struct {
		Name           string `bigquery:"name"`
		ContainerImage struct {
			Name         string        `bigquery:"name"`
			Tag          string        `bigquery:"tag"`
			IsPulled     bool          `bigquery:"is_pulled"`
			ImageSize    int           `bigquery:"image_size"`
			PullDuration time.Duration `bigquery:"pull_duration"`
			IsTrusted    bool          `bigquery:"is_trusted"`
		} `bigquery:"container_image"`

		RunDuration time.Duration `bigquery:"run_duration"`
		LogLines    []struct {
			Timestamp  time.Time `bigquery:"timestamp"`
			StreamType string    `bigquery:"stream_type"`
			Text       string    `bigquery:"text"`
		} `bigquery:"log_lines"`
	} `bigquery:"stages"`
	InsertedAt time.Time `bigquery:"inserted_at"`
}

Job represent and actual job execution; a build / release can have multiple runs of a job if Kubernetes reschedules it

type MockClient

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

MockClient is a mock of Client interface

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance

func (*MockClient) CheckIfDatasetExists

func (m *MockClient) CheckIfDatasetExists(ctx context.Context) bool

CheckIfDatasetExists mocks base method

func (*MockClient) CheckIfTableExists

func (m *MockClient) CheckIfTableExists(ctx context.Context, table string) bool

CheckIfTableExists mocks base method

func (*MockClient) CreateTable

func (m *MockClient) CreateTable(ctx context.Context, table string, typeForSchema interface{}, partitionField string, waitReady bool) error

CreateTable mocks base method

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClient) Init

func (m *MockClient) Init(ctx context.Context) error

Init mocks base method

func (*MockClient) InsertBuildEvent

func (m *MockClient) InsertBuildEvent(ctx context.Context, event PipelineBuildEvent) error

InsertBuildEvent mocks base method

func (*MockClient) InsertReleaseEvent

func (m *MockClient) InsertReleaseEvent(ctx context.Context, event PipelineReleaseEvent) error

InsertReleaseEvent mocks base method

func (*MockClient) UpdateTableSchema

func (m *MockClient) UpdateTableSchema(ctx context.Context, table string, typeForSchema interface{}) error

UpdateTableSchema mocks base method

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient

func (*MockClientMockRecorder) CheckIfDatasetExists

func (mr *MockClientMockRecorder) CheckIfDatasetExists(ctx interface{}) *gomock.Call

CheckIfDatasetExists indicates an expected call of CheckIfDatasetExists

func (*MockClientMockRecorder) CheckIfTableExists

func (mr *MockClientMockRecorder) CheckIfTableExists(ctx, table interface{}) *gomock.Call

CheckIfTableExists indicates an expected call of CheckIfTableExists

func (*MockClientMockRecorder) CreateTable

func (mr *MockClientMockRecorder) CreateTable(ctx, table, typeForSchema, partitionField, waitReady interface{}) *gomock.Call

CreateTable indicates an expected call of CreateTable

func (*MockClientMockRecorder) Init

func (mr *MockClientMockRecorder) Init(ctx interface{}) *gomock.Call

Init indicates an expected call of Init

func (*MockClientMockRecorder) InsertBuildEvent

func (mr *MockClientMockRecorder) InsertBuildEvent(ctx, event interface{}) *gomock.Call

InsertBuildEvent indicates an expected call of InsertBuildEvent

func (*MockClientMockRecorder) InsertReleaseEvent

func (mr *MockClientMockRecorder) InsertReleaseEvent(ctx, event interface{}) *gomock.Call

InsertReleaseEvent indicates an expected call of InsertReleaseEvent

func (*MockClientMockRecorder) UpdateTableSchema

func (mr *MockClientMockRecorder) UpdateTableSchema(ctx, table, typeForSchema interface{}) *gomock.Call

UpdateTableSchema indicates an expected call of UpdateTableSchema

type PipelineBuildEvent

type PipelineBuildEvent struct {
	BuildID      int    `bigquery:"build_id"`
	RepoSource   string `bigquery:"repo_source"`
	RepoOwner    string `bigquery:"repo_owner"`
	RepoName     string `bigquery:"repo_name"`
	RepoBranch   string `bigquery:"repo_branch"`
	RepoRevision string `bigquery:"repo_revision"`
	BuildVersion string `bigquery:"build_version"`
	BuildStatus  string `bigquery:"build_status"`

	Labels []struct {
		Key   string `bigquery:"key"`
		Value string `bigquery:"value"`
	} `bigquery:"labels"`

	InsertedAt time.Time `bigquery:"inserted_at"`
	UpdatedAt  time.Time `bigquery:"updated_at"`

	Commits []struct {
		Message string `bigquery:"message"`
		Author  struct {
			Email string `bigquery:"email"`
		} `bigquery:"author"`
	} `bigquery:"commits"`

	CPURequest     bigquery.NullFloat64 `bigquery:"cpu_request"`
	CPULimit       bigquery.NullFloat64 `bigquery:"cpu_limit"`
	CPUMaxUsage    bigquery.NullFloat64 `bigquery:"cpu_max_usage"`
	MemoryRequest  bigquery.NullFloat64 `bigquery:"memory_request"`
	MemoryLimit    bigquery.NullFloat64 `bigquery:"memory_limit"`
	MemoryMaxUsage bigquery.NullFloat64 `bigquery:"memory_max_usage"`

	TotalDuration time.Duration `bigquery:"duration"`
	TimeToRunning time.Duration `bigquery:"time_to_running"`

	Manifest string `bigquery:"manifest"`

	Jobs []Job `bigquery:"logs"`
}

PipelineBuildEvent tracks a build once it's finished

type PipelineReleaseEvent

type PipelineReleaseEvent struct {
	ReleaseID      int    `bigquery:"release_id"`
	RepoSource     string `bigquery:"repo_source"`
	RepoOwner      string `bigquery:"repo_owner"`
	RepoName       string `bigquery:"repo_name"`
	ReleaseTarget  string `bigquery:"release_target"`
	ReleaseVersion string `bigquery:"release_version"`
	ReleaseStatus  string `bigquery:"release_status"`

	Labels []struct {
		Key   string `bigquery:"key"`
		Value string `bigquery:"value"`
	} `bigquery:"labels"`

	InsertedAt time.Time `bigquery:"inserted_at"`
	UpdatedAt  time.Time `bigquery:"updated_at"`

	CPURequest     bigquery.NullFloat64 `bigquery:"cpu_request"`
	CPULimit       bigquery.NullFloat64 `bigquery:"cpu_limit"`
	CPUMaxUsage    bigquery.NullFloat64 `bigquery:"cpu_max_usage"`
	MemoryRequest  bigquery.NullFloat64 `bigquery:"memory_request"`
	MemoryLimit    bigquery.NullFloat64 `bigquery:"memory_limit"`
	MemoryMaxUsage bigquery.NullFloat64 `bigquery:"memory_max_usage"`

	TotalDuration time.Duration `bigquery:"duration"`
	TimeToRunning time.Duration `bigquery:"time_to_running"`

	Jobs []Job `bigquery:"logs"`
}

PipelineReleaseEvent tracks a release once it's finished

Jump to

Keyboard shortcuts

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