bigquery

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithInRangeForDateShardingTable added in v1.18.3

func WithInRangeForDateShardingTable(tableID string, start string, end string) (bool, error)

WithInRangeForDateShardingTable is tableで指定したテーブル名がstart, endで指定したYYYYMMDDの範囲にあるかを返す Ex: table=hoge20190101 start=20180101 end=20190102

Types

type APIOptions added in v1.17.0

type APIOptions func(options *apiOptions)

func WithDryRun added in v1.17.0

func WithDryRun() APIOptions

WithDryRun is 変更が発生するbigqueryのAPIは実行しない

func WithStreamLogFn added in v1.17.0

func WithStreamLogFn(f func(msg string)) APIOptions

WithStreamLogFn is Query結果を元にAPIを実行した時にログを処理できる関数を指定できる

func WithWait added in v1.18.3

func WithWait() APIOptions

WithWait is Jobが一つずつ完了するのを待ってから、次のJobを投入する

type BQColumn added in v1.18.0

type BQColumn struct {
	Name     string
	Children map[string]*BQColumn
	Target   bool
}

type BigQueryService

type BigQueryService struct {
	BQ *bigquery.Client
}

func NewBigQueryService

func NewBigQueryService(bq *bigquery.Client) (*BigQueryService, error)

func (*BigQueryService) Close

func (s *BigQueryService) Close() error

func (*BigQueryService) Insert

func (s *BigQueryService) Insert(ctx context.Context, dataset *bigquery.Dataset, table string, sss []*bigquery.StructSaver) error

InsertStructSaverToBigQuery is StructSaverをBigQueryにStreamingInsertでInsertする InsertはAtomicには行われない。 Error時は StreamingInsertErrors を返す。

type DateShardingTableTarget added in v1.18.3

type DateShardingTableTarget struct {
	// Prefix is TableID Prefix
	Prefix string

	// Start is Start YYYYMMDD
	Start string

	// End is End YYYYMMDD
	End string
}

func (*DateShardingTableTarget) Match added in v1.18.3

func (t *DateShardingTableTarget) Match(tableID string) (bool, error)

type JobResult added in v1.18.3

type JobResult struct {
	TableID string
	Job     *bigquery.Job
}

type Service added in v1.17.0

type Service struct {
	BQ *bigquery.Client
}

func NewService added in v1.17.0

func NewService(ctx context.Context, bq *bigquery.Client) (*Service, error)

func (*Service) Close added in v1.17.0

func (s *Service) Close(ctx context.Context) error

func (*Service) DeleteTablesByTablePrefix added in v1.17.0

func (s *Service) DeleteTablesByTablePrefix(ctx context.Context, projectID string, datasetID string, tablePrefix string, ops ...APIOptions) ([]string, error)

DeleteTablesByTablePrefix is 指定したPrefixに合致するTableを削除する

削除したTableIDの一覧を返す 途中で削除に失敗した場合もそれまで削除したTableIDの一覧は返す

type StreamingInsertError

type StreamingInsertError struct {
	InsertID string
	Err      error
}

func (*StreamingInsertError) Error

func (e *StreamingInsertError) Error() string

type StreamingInsertErrors

type StreamingInsertErrors struct {
	Errors []*StreamingInsertError
	// contains filtered or unexported fields
}

func (*StreamingInsertErrors) Append

func (*StreamingInsertErrors) Error

func (e *StreamingInsertErrors) Error() string

func (*StreamingInsertErrors) ErrorOrNil

func (e *StreamingInsertErrors) ErrorOrNil() error

type TableService added in v1.18.0

type TableService struct {
	BQ *bigquery.Client
}

func NewTableService added in v1.18.0

func NewTableService(ctx context.Context, bq *bigquery.Client) (*TableService, error)

func (*TableService) Close added in v1.18.0

func (s *TableService) Close(ctx context.Context) error

func (*TableService) DeleteByPrefix added in v1.18.0

func (s *TableService) DeleteByPrefix(ctx context.Context, projectID string, datasetID string, tablePrefix string, ops ...APIOptions) ([]string, error)

DeleteByPrefix is 指定したPrefixに合致するTableを削除する

削除したTableIDの一覧を返す 途中で削除に失敗した場合もそれまで削除したTableIDの一覧は返す

func (*TableService) ExistColumn added in v1.18.0

func (s *TableService) ExistColumn(ctx context.Context, projectID string, datasetID string, tableID string, target string) (bool, error)

ExistColumn is 対象のTableに対象のColumnがある場合は、trueを返す ARRAY(STRUCT)には対応していない

func (*TableService) RunDMLToShardingTables added in v1.18.3

func (s *TableService) RunDMLToShardingTables(ctx context.Context, projectID string, datasetID string, target *DateShardingTableTarget, dml string, ops ...APIOptions) ([]string, error)

RunDMLToShardingTables is ShardingTableに対してDMLを実行する

Jump to

Keyboard shortcuts

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