Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type ConfigProvider
- type DataOptions
- type Dataset
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) CancelJob(project, id string) (map[string]any, error)
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) CreateAssignment(project, location, reservation, id string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateCapacityCommitment(project, location, id string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateDataset(project string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateReservation(project, location, id string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateRoutine(project, ds string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateRowPolicy(project, ds, table string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) CreateTable(project, ds string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) DeleteAssignment(project, location, reservation, id string) error
- func (b *InMemoryBackend) DeleteCapacityCommitment(project, location, id string) error
- func (b *InMemoryBackend) DeleteDataset(project, id string, deleteContents bool) error
- func (b *InMemoryBackend) DeleteJob(project, id string) error
- func (b *InMemoryBackend) DeleteReservation(project, location, id string) error
- func (b *InMemoryBackend) DeleteRoutine(project, ds, id string) error
- func (b *InMemoryBackend) DeleteRowPolicies(project, ds, table string, ids []string, force bool) error
- func (b *InMemoryBackend) DeleteTable(project, ds, id string) error
- func (b *InMemoryBackend) GetBiReservation(project, location string) map[string]any
- func (b *InMemoryBackend) GetCapacityCommitment(project, location, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetDataset(project, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetJob(project, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetQueryResults(project, id string, o QueryResultOptions) (map[string]any, error)
- func (b *InMemoryBackend) GetReservation(project, location, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetRoutine(project, ds, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetRowPolicy(project, ds, table, id string) (map[string]any, error)
- func (b *InMemoryBackend) GetTable(project, ds, id string) (map[string]any, error)
- func (b *InMemoryBackend) InsertAll(project, ds, id string, req InsertRequest) (map[string]any, error)
- func (b *InMemoryBackend) InsertJob(ctx context.Context, project string, body map[string]any, media []byte) (map[string]any, error)
- func (b *InMemoryBackend) ListAssignments(project, location, reservation string, o ListOptions) (page.Page[map[string]any], error)
- func (b *InMemoryBackend) ListCapacityCommitments(project, location string, o ListOptions) page.Page[map[string]any]
- func (b *InMemoryBackend) ListData(project, ds, id string, o DataOptions) (map[string]any, error)
- func (b *InMemoryBackend) ListDatasets(project string, o ListOptions) page.Page[map[string]any]
- func (b *InMemoryBackend) ListJobs(project string, o JobListOptions) page.Page[map[string]any]
- func (b *InMemoryBackend) ListProjects() []map[string]any
- func (b *InMemoryBackend) ListReservations(project, location string, o ListOptions) page.Page[map[string]any]
- func (b *InMemoryBackend) ListRoutines(project, ds string, o ListOptions, readMask string) (page.Page[map[string]any], error)
- func (b *InMemoryBackend) ListRowPolicies(project, ds, table string, o ListOptions) (page.Page[map[string]any], error)
- func (b *InMemoryBackend) ListTables(project, ds string, o ListOptions) (page.Page[map[string]any], error)
- func (b *InMemoryBackend) MergeCapacityCommitments(project, location string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) MoveAssignment(project, location, reservation, id string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RunQuery(ctx context.Context, project string, req map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) SearchAssignments(project, location, query string, o ListOptions) (page.Page[map[string]any], error)
- func (b *InMemoryBackend) SetExtractShardBytes(n int64)
- func (b *InMemoryBackend) SetJobStartHook(fn func(ctx context.Context, phase, project, id string))
- func (b *InMemoryBackend) SetLoadLimits(files int, bytes int64)
- func (b *InMemoryBackend) SetObjectStore(s ObjectStore)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) SplitCapacityCommitment(project, location, id string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateAssignment(project, location, reservation, id, mask string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateBiReservation(project, location, mask string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateCapacityCommitment(project, location, id, mask string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateDataset(project, id string, body map[string]any, replace bool) (map[string]any, error)
- func (b *InMemoryBackend) UpdateReservation(project, location, id, mask string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateRoutine(project, ds, id, ifMatch string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateRowPolicy(project, ds, table, id, ifMatch string, body map[string]any) (map[string]any, error)
- func (b *InMemoryBackend) UpdateTable(project, ds, id string, body map[string]any, replace bool) (map[string]any, error)
- type InsertRequest
- type InsertRow
- type Job
- type JobListOptions
- type ListOptions
- type ObjectStore
- type Provider
- type QueryResultOptions
- type Routine
- type RowPolicy
- type Settings
- type StreamBuffer
- type Table
- type TableVersion
Constants ¶
const DefaultPort = 9050
DefaultPort is the dedicated listener's default TCP port.
Variables ¶
var ErrNilAppContext = errors.New("gcpbigquery: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
var ErrObjectNotFound = errors.New("object not found")
ErrObjectNotFound is returned by an ObjectStore when a bucket or object does not exist.
var ErrSnapshotNull = errors.New("gcpbigquery: snapshot contains a null dataset")
ErrSnapshotNull is returned when a snapshot holds a null dataset.
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
GetGCPBigQuerySettings() Settings
}
ConfigProvider extracts BigQuery configuration from the AppContext Config.
type DataOptions ¶
type DataOptions struct {
PageToken string
SelectedFields string
StartIndex int
Max int
Int64Timestamp bool
}
DataOptions are the tabledata.list parameters.
type Dataset ¶
type Dataset struct {
Meta map[string]any `json:"meta"`
Tables map[string]*Table `json:"tables"`
Routines map[string]*Routine `json:"routines,omitempty"`
Location string `json:"location"`
Created int64 `json:"created"`
Modified int64 `json:"modified"`
Hidden bool `json:"hidden,omitempty"`
}
Dataset is a BigQuery dataset. Meta holds the writable passthrough fields (labels, access, description, ...).
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
Port int
// contains filtered or unexported fields
}
Handler serves the BigQuery v2 REST API.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a Handler; callers override Port from Settings.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns project[/dataset[.table]] for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler for all BigQuery requests.
func (*Handler) MatchPriority ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: BigQuery runs on its own listener.
func (*Handler) Shutdown ¶
Shutdown stops the dedicated listener, forcing a close if graceful shutdown fails.
type InMemoryBackend ¶
type InMemoryBackend struct {
// Audit records Cloud Audit Logs entries for dataset, table and job changes.
Audit gcpaudit.Emitter
// contains filtered or unexported fields
}
InMemoryBackend holds every dataset, table, row and job under one lock.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend.
func (*InMemoryBackend) CancelJob ¶
func (b *InMemoryBackend) CancelJob(project, id string) (map[string]any, error)
CancelJob implements jobs.cancel: a PENDING or RUNNING job is asked to stop and finishes with errorResult stopped; a finished job is returned as is.
func (*InMemoryBackend) Close ¶
func (b *InMemoryBackend) Close()
Close cancels every unfinished job and waits for the workers to stop.
func (*InMemoryBackend) CreateAssignment ¶
func (b *InMemoryBackend) CreateAssignment( project, location, reservation, id string, body map[string]any, ) (map[string]any, error)
CreateAssignment implements reservations.assignments.create.
func (*InMemoryBackend) CreateCapacityCommitment ¶
func (b *InMemoryBackend) CreateCapacityCommitment( project, location, id string, body map[string]any, ) (map[string]any, error)
CreateCapacityCommitment implements capacityCommitments.create.
func (*InMemoryBackend) CreateDataset ¶
func (b *InMemoryBackend) CreateDataset(project string, body map[string]any) (map[string]any, error)
CreateDataset implements datasets.insert.
func (*InMemoryBackend) CreateReservation ¶
func (b *InMemoryBackend) CreateReservation( project, location, id string, body map[string]any, ) (map[string]any, error)
CreateReservation implements reservations.create.
func (*InMemoryBackend) CreateRoutine ¶
func (b *InMemoryBackend) CreateRoutine(project, ds string, body map[string]any) (map[string]any, error)
CreateRoutine implements routines.insert.
func (*InMemoryBackend) CreateRowPolicy ¶
func (b *InMemoryBackend) CreateRowPolicy(project, ds, table string, body map[string]any) (map[string]any, error)
CreateRowPolicy implements rowAccessPolicies.insert.
func (*InMemoryBackend) CreateTable ¶
func (b *InMemoryBackend) CreateTable(project, ds string, body map[string]any) (map[string]any, error)
CreateTable implements tables.insert.
func (*InMemoryBackend) DeleteAssignment ¶
func (b *InMemoryBackend) DeleteAssignment(project, location, reservation, id string) error
DeleteAssignment implements reservations.assignments.delete.
func (*InMemoryBackend) DeleteCapacityCommitment ¶
func (b *InMemoryBackend) DeleteCapacityCommitment(project, location, id string) error
DeleteCapacityCommitment implements capacityCommitments.delete; it fails before the commitment end time.
func (*InMemoryBackend) DeleteDataset ¶
func (b *InMemoryBackend) DeleteDataset(project, id string, deleteContents bool) error
DeleteDataset implements datasets.delete.
func (*InMemoryBackend) DeleteJob ¶
func (b *InMemoryBackend) DeleteJob(project, id string) error
DeleteJob implements jobs.delete.
func (*InMemoryBackend) DeleteReservation ¶
func (b *InMemoryBackend) DeleteReservation(project, location, id string) error
DeleteReservation implements reservations.delete; a reservation with assignments cannot be deleted.
func (*InMemoryBackend) DeleteRoutine ¶
func (b *InMemoryBackend) DeleteRoutine(project, ds, id string) error
DeleteRoutine implements routines.delete.
func (*InMemoryBackend) DeleteRowPolicies ¶
func (b *InMemoryBackend) DeleteRowPolicies(project, ds, table string, ids []string, force bool) error
DeleteRowPolicies implements rowAccessPolicies.delete and batchDelete. Removing the last policy widens access, so it needs force.
func (*InMemoryBackend) DeleteTable ¶
func (b *InMemoryBackend) DeleteTable(project, ds, id string) error
DeleteTable implements tables.delete.
func (*InMemoryBackend) GetBiReservation ¶
func (b *InMemoryBackend) GetBiReservation(project, location string) map[string]any
GetBiReservation implements getBiReservation.
func (*InMemoryBackend) GetCapacityCommitment ¶
func (b *InMemoryBackend) GetCapacityCommitment(project, location, id string) (map[string]any, error)
GetCapacityCommitment implements capacityCommitments.get.
func (*InMemoryBackend) GetDataset ¶
func (b *InMemoryBackend) GetDataset(project, id string) (map[string]any, error)
GetDataset implements datasets.get.
func (*InMemoryBackend) GetJob ¶
func (b *InMemoryBackend) GetJob(project, id string) (map[string]any, error)
GetJob implements jobs.get.
func (*InMemoryBackend) GetQueryResults ¶
func (b *InMemoryBackend) GetQueryResults(project, id string, o QueryResultOptions) (map[string]any, error)
GetQueryResults implements jobs.getQueryResults; it waits up to timeoutMs (default 10 s) for a job that is not done and then answers jobComplete=false.
func (*InMemoryBackend) GetReservation ¶
func (b *InMemoryBackend) GetReservation(project, location, id string) (map[string]any, error)
GetReservation implements reservations.get.
func (*InMemoryBackend) GetRoutine ¶
func (b *InMemoryBackend) GetRoutine(project, ds, id string) (map[string]any, error)
GetRoutine implements routines.get.
func (*InMemoryBackend) GetRowPolicy ¶
func (b *InMemoryBackend) GetRowPolicy(project, ds, table, id string) (map[string]any, error)
GetRowPolicy implements rowAccessPolicies.get.
func (*InMemoryBackend) GetTable ¶
func (b *InMemoryBackend) GetTable(project, ds, id string) (map[string]any, error)
GetTable implements tables.get.
func (*InMemoryBackend) InsertAll ¶
func (b *InMemoryBackend) InsertAll(project, ds, id string, req InsertRequest) (map[string]any, error)
InsertAll implements tabledata.insertAll.
func (*InMemoryBackend) InsertJob ¶
func (b *InMemoryBackend) InsertJob( ctx context.Context, project string, body map[string]any, media []byte, ) (map[string]any, error)
InsertJob implements jobs.insert; media carries the body of a multipart or resumable upload for load jobs.
func (*InMemoryBackend) ListAssignments ¶
func (b *InMemoryBackend) ListAssignments( project, location, reservation string, o ListOptions, ) (page.Page[map[string]any], error)
ListAssignments implements reservations.assignments.list; reservation "-" lists every reservation's assignments.
func (*InMemoryBackend) ListCapacityCommitments ¶
func (b *InMemoryBackend) ListCapacityCommitments(project, location string, o ListOptions) page.Page[map[string]any]
ListCapacityCommitments implements capacityCommitments.list.
func (*InMemoryBackend) ListData ¶
func (b *InMemoryBackend) ListData(project, ds, id string, o DataOptions) (map[string]any, error)
ListData implements tabledata.list.
func (*InMemoryBackend) ListDatasets ¶
func (b *InMemoryBackend) ListDatasets(project string, o ListOptions) page.Page[map[string]any]
ListDatasets implements datasets.list.
func (*InMemoryBackend) ListJobs ¶
func (b *InMemoryBackend) ListJobs(project string, o JobListOptions) page.Page[map[string]any]
ListJobs implements jobs.list, newest first.
func (*InMemoryBackend) ListProjects ¶
func (b *InMemoryBackend) ListProjects() []map[string]any
ListProjects implements projects.list over every project that owns a dataset or a job.
func (*InMemoryBackend) ListReservations ¶
func (b *InMemoryBackend) ListReservations(project, location string, o ListOptions) page.Page[map[string]any]
ListReservations implements reservations.list.
func (*InMemoryBackend) ListRoutines ¶
func (b *InMemoryBackend) ListRoutines( project, ds string, o ListOptions, readMask string, ) (page.Page[map[string]any], error)
ListRoutines implements routines.list; filter is routineType:{type} and readMask adds fields to the summary.
func (*InMemoryBackend) ListRowPolicies ¶
func (b *InMemoryBackend) ListRowPolicies( project, ds, table string, o ListOptions, ) (page.Page[map[string]any], error)
ListRowPolicies implements rowAccessPolicies.list, ordered by policy ID.
func (*InMemoryBackend) ListTables ¶
func (b *InMemoryBackend) ListTables(project, ds string, o ListOptions) (page.Page[map[string]any], error)
ListTables implements tables.list.
func (*InMemoryBackend) MergeCapacityCommitments ¶
func (b *InMemoryBackend) MergeCapacityCommitments( project, location string, body map[string]any, ) (map[string]any, error)
MergeCapacityCommitments implements capacityCommitments.merge: commitments of one plan become a single one.
func (*InMemoryBackend) MoveAssignment ¶
func (b *InMemoryBackend) MoveAssignment( project, location, reservation, id string, body map[string]any, ) (map[string]any, error)
MoveAssignment implements reservations.assignments.move into another reservation of the same location.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a snapshot.
func (*InMemoryBackend) RunQuery ¶
func (b *InMemoryBackend) RunQuery(ctx context.Context, project string, req map[string]any) (map[string]any, error)
RunQuery implements jobs.query: it creates a query job, runs it and returns the first page of results.
func (*InMemoryBackend) SearchAssignments ¶
func (b *InMemoryBackend) SearchAssignments( project, location, query string, o ListOptions, ) (page.Page[map[string]any], error)
SearchAssignments implements searchAssignments and searchAllAssignments; the query is assignee="projects/x".
func (*InMemoryBackend) SetExtractShardBytes ¶
func (b *InMemoryBackend) SetExtractShardBytes(n int64)
SetExtractShardBytes sets the shard size of extract jobs; n <= 0 restores the 1 GiB default.
func (*InMemoryBackend) SetJobStartHook ¶
func (b *InMemoryBackend) SetJobStartHook(fn func(ctx context.Context, phase, project, id string))
SetJobStartHook runs fn on the job's worker in phase PENDING (before) and RUNNING (after the state change); tests use it to hold a job in either state.
func (*InMemoryBackend) SetLoadLimits ¶
func (b *InMemoryBackend) SetLoadLimits(files int, bytes int64)
SetLoadLimits sets the source file count and decompressed byte caps of a load job; zero keeps the default.
func (*InMemoryBackend) SetObjectStore ¶
func (b *InMemoryBackend) SetObjectStore(s ObjectStore)
SetObjectStore wires the object store load and extract jobs read from and write to.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state.
func (*InMemoryBackend) SplitCapacityCommitment ¶
func (b *InMemoryBackend) SplitCapacityCommitment( project, location, id string, body map[string]any, ) (map[string]any, error)
SplitCapacityCommitment implements capacityCommitments.split; the pieces keep the plan and end time.
func (*InMemoryBackend) UpdateAssignment ¶
func (b *InMemoryBackend) UpdateAssignment( project, location, reservation, id, mask string, body map[string]any, ) (map[string]any, error)
UpdateAssignment implements reservations.assignments.patch; the assignee and job type are fixed.
func (*InMemoryBackend) UpdateBiReservation ¶
func (b *InMemoryBackend) UpdateBiReservation( project, location, mask string, body map[string]any, ) (map[string]any, error)
UpdateBiReservation implements updateBiReservation.
func (*InMemoryBackend) UpdateCapacityCommitment ¶
func (b *InMemoryBackend) UpdateCapacityCommitment( project, location, id, mask string, body map[string]any, ) (map[string]any, error)
UpdateCapacityCommitment implements capacityCommitments.patch: only plan and renewalPlan change, and the plan can only move to a longer commitment period.
func (*InMemoryBackend) UpdateDataset ¶
func (b *InMemoryBackend) UpdateDataset(project, id string, body map[string]any, replace bool) (map[string]any, error)
UpdateDataset implements datasets.patch (merge) and datasets.update (replace).
func (*InMemoryBackend) UpdateReservation ¶
func (b *InMemoryBackend) UpdateReservation( project, location, id, mask string, body map[string]any, ) (map[string]any, error)
UpdateReservation implements reservations.patch.
func (*InMemoryBackend) UpdateRoutine ¶
func (b *InMemoryBackend) UpdateRoutine( project, ds, id, ifMatch string, body map[string]any, ) (map[string]any, error)
UpdateRoutine implements routines.update. The Go client sends only the changed fields, so the body merges into the stored routine (a null removes a field); a non-empty ifMatch must equal the current etag.
func (*InMemoryBackend) UpdateRowPolicy ¶
func (b *InMemoryBackend) UpdateRowPolicy( project, ds, table, id, ifMatch string, body map[string]any, ) (map[string]any, error)
UpdateRowPolicy implements rowAccessPolicies.update: the filter is replaced and the grantee list only when sent.
func (*InMemoryBackend) UpdateTable ¶
func (b *InMemoryBackend) UpdateTable( project, ds, id string, body map[string]any, replace bool, ) (map[string]any, error)
UpdateTable implements tables.patch (merge) and tables.update (replace).
type InsertRequest ¶
type InsertRequest struct {
TemplateSuffix string `json:"templateSuffix"`
Rows []InsertRow `json:"rows"`
SkipInvalidRows bool `json:"skipInvalidRows"`
IgnoreUnknownValues bool `json:"ignoreUnknownValues"`
}
InsertRequest is the tabledata.insertAll request body.
type Job ¶
type Job struct {
Config map[string]any `json:"config"`
Stats map[string]any `json:"stats"`
ErrorResult *jobError `json:"errorResult,omitempty"`
Errors []*jobError `json:"errors,omitempty"`
Dest *tableRef `json:"dest,omitempty"`
Project string `json:"project"`
ID string `json:"id"`
Location string `json:"location"`
RequestID string `json:"requestId,omitempty"`
Type string `json:"type"`
State string `json:"state"`
User string `json:"user"`
Schema []bqsql.Field `json:"schema,omitempty"`
Rows [][]any `json:"rows,omitempty"`
Created int64 `json:"created"`
Started int64 `json:"started"`
Ended int64 `json:"ended"`
NumDML int64 `json:"numDml"`
DryRun bool `json:"dryRun,omitempty"`
HasResult bool `json:"hasResult,omitempty"`
}
Job is a BigQuery job. Query jobs keep their result rows so getQueryResults can page them.
type JobListOptions ¶
type JobListOptions struct {
PageToken string
Parent string
StateFilter []string
MinCreated int64
MaxCreated int64
Max int
}
JobListOptions are the jobs.list parameters.
type ListOptions ¶
ListOptions carries the paging parameters shared by list calls.
type ObjectStore ¶
type ObjectStore interface {
// ListObjects returns the names of every object in bucket that starts with prefix.
ListObjects(bucket, prefix string) ([]string, error)
// ReadObject returns the content of one object.
ReadObject(bucket, name string) ([]byte, error)
// WriteObject creates or replaces one object.
WriteObject(bucket, name string, data []byte, contentType string) error
}
ObjectStore is the slice of Cloud Storage that load and extract jobs need.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Google BigQuery. It serves the REST API on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler; the port is bound in StartWorker.
type QueryResultOptions ¶
type QueryResultOptions struct {
TimeoutMs *int
PageToken string
StartIndex int
Max int
Int64Timestamp bool
}
QueryResultOptions are the getQueryResults parameters.
type Routine ¶
type Routine struct {
Resource map[string]any `json:"resource"`
Created int64 `json:"created"`
Modified int64 `json:"modified"`
Seq int64 `json:"seq"`
}
Routine is a stored function or procedure; Resource holds the writable REST fields.
type RowPolicy ¶
type RowPolicy struct {
ID string `json:"id"`
Filter string `json:"filter"`
Grantees []string `json:"grantees"`
Created int64 `json:"created"`
Modified int64 `json:"modified"`
Seq int64 `json:"seq"`
}
RowPolicy is a row access policy stored on a table.
type Settings ¶
type Settings struct {
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 164-byte string literal not displayed */
}
Settings holds service-level configuration, embedded in the root CLI command as CLI.GCPBigQuery.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider is available.
type StreamBuffer ¶
type StreamBuffer struct {
Rows int64 `json:"rows"`
Bytes int64 `json:"bytes"`
OldestMs int64 `json:"oldestMs"`
}
StreamBuffer tracks rows written through tabledata.insertAll that real BigQuery has not yet flushed.
type Table ¶
type Table struct {
Stream *StreamBuffer `json:"stream,omitempty"`
Meta map[string]any `json:"meta"`
Seen map[string]int64 `json:"seen,omitempty"`
ViewQuery string `json:"viewQuery,omitempty"`
MV map[string]any `json:"mv,omitempty"`
Schema []bqsql.Field `json:"schema"`
Rows [][]any `json:"rows"`
History []TableVersion `json:"history,omitempty"`
RowPolicies []*RowPolicy `json:"rowPolicies,omitempty"`
Created int64 `json:"created"`
Modified int64 `json:"modified"`
Seq int64 `json:"seq"`
}
Table is a table or view with its rows in the canonical stored encoding.
Source Files
¶
- audit.go
- autodetect.go
- avro_read.go
- consts.go
- datasets.go
- errors.go
- external.go
- extract_avro.go
- handler.go
- jobs.go
- jobs_async.go
- jobs_copy.go
- jobs_extract.go
- jobs_load.go
- jobs_query.go
- jobs_script.go
- load_formats.go
- model.go
- objects.go
- params.go
- persistence.go
- provider.go
- reservation_routes.go
- reservations.go
- route.go
- routines.go
- rowpolicies.go
- settings.go
- store.go
- tabledata.go
- tables.go
- upload.go
- wire.go