Documentation ¶
Index ¶
- Constants
- func BackupResources(ctx context.Context, backup *resource.Backup, resources []*resource.Resource, ...) (*resource.BackupResult, error)
- func BackupTable(ctx context.Context, backup *resource.Backup, source *resource.Resource, ...) (string, error)
- func BatchesFrom(resources []*resource.Resource, provider ClientProvider) (map[string]*Batch, error)
- func ConfigAs[T any](mapping map[string]any, key string) T
- func ConvertSpecTo[T DatasetDetails | Table | View | ExternalTable](res *resource.Resource) (*T, error)
- func CopyTable(ctx context.Context, source, destination TableResourceHandle) error
- func CreateIfDatasetDoesNotExist(ctx context.Context, client Client, dataset Dataset) error
- func DestinationExpiry(backup *resource.Backup) (time.Time, error)
- func DestinationName(sourceDatasetName, sourceName string, backup *resource.Backup) string
- func ResourceNameFor(name resource.Name, kind string) (string, error)
- func URNFor(res *resource.Resource) (resource.URN, error)
- func ValidateName(res *resource.Resource) error
- type BQCopier
- type BQJob
- type Batch
- type BqClient
- func (c *BqClient) BulkGetDDLView(ctx context.Context, pd ProjectDataset, names []string) (map[ResourceURN]string, error)
- func (c *BqClient) DatasetHandleFrom(ds Dataset) ResourceHandle
- func (c *BqClient) ExternalTableHandleFrom(ds Dataset, name string) ResourceHandle
- func (c *BqClient) ModelHandleFrom(ds Dataset, name string) ResourceHandle
- func (c *BqClient) RoutineHandleFrom(ds Dataset, name string) ResourceHandle
- func (c *BqClient) TableHandleFrom(ds Dataset, name string) TableResourceHandle
- func (c *BqClient) ViewHandleFrom(ds Dataset, name string) ResourceHandle
- type BqClientProvider
- type BqDataset
- type BqModel
- type BqRoutine
- type BqTable
- type Client
- type ClientProvider
- type Cluster
- type Copier
- type CopyJob
- type Dataset
- type DatasetDetails
- type DatasetHandle
- type ExternalSource
- type ExternalTable
- type ExternalTableHandle
- type Field
- type JobHandle
- type ModelHandle
- type Partition
- type ProjectDataset
- type Range
- type ResourceHandle
- type ResourceURN
- type ResourceURNWithUpstreams
- type ResourceURNWithUpstreamsList
- type ResourceURNs
- type RoutineHandle
- type Schema
- type SecretProvider
- type Store
- func (s Store) Backup(ctx context.Context, backup *resource.Backup, resources []*resource.Resource) (*resource.BackupResult, error)
- func (s Store) BatchUpdate(ctx context.Context, resources []*resource.Resource) error
- func (s Store) Create(ctx context.Context, res *resource.Resource) error
- func (s Store) Exist(ctx context.Context, tnnt tenant.Tenant, urn resource.URN) (bool, error)
- func (Store) GetURN(res *resource.Resource) (resource.URN, error)
- func (s Store) Update(ctx context.Context, res *resource.Resource) error
- func (Store) Validate(r *resource.Resource) error
- type Table
- type TableCopier
- type TableHandle
- func (t TableHandle) CopierFrom(source TableResourceHandle) (TableCopier, error)
- func (t TableHandle) Create(ctx context.Context, res *resource.Resource) error
- func (t TableHandle) Exists(ctx context.Context) bool
- func (t TableHandle) GetBQTable() (*bigquery.Table, error)
- func (t TableHandle) Update(ctx context.Context, res *resource.Resource) error
- func (t TableHandle) UpdateExpiry(ctx context.Context, name string, expiry time.Time) error
- type TableResourceHandle
- type URNComponent
- type View
- type ViewHandle
Constants ¶
View Source
const ( ConcurrentTicketPerSec = 5 ConcurrentLimit = 20 )
View Source
const ( EntityDataset = "dataset" DatesetNameSections = 2 TableNameSections = 3 )
View Source
const ( ModeNullable = "nullable" ModeRequired = "required" ModeRepeated = "repeated" EntityResourceSchema = "bigquery_schema" )
View Source
const ( KindDataset string = "dataset" KindTable string = "table" KindView string = "view" KindExternalTable string = "external_table" KindRoutine string = "routine" KindModel string = "model" )
View Source
const (
EntityExternalTable = "resource_external_table"
)
View Source
const EntityModel = "resource_model"
View Source
const EntityRoutine = "resource_routine"
View Source
const (
EntityTable = "resource_table"
)
View Source
const (
EntityView = "resource_view"
)
Variables ¶
This section is empty.
Functions ¶
func BackupResources ¶
func BackupTable ¶
func BatchesFrom ¶
func ConvertSpecTo ¶
func ConvertSpecTo[T DatasetDetails | Table | View | ExternalTable](res *resource.Resource) (*T, error)
func DestinationName ¶
func ValidateName ¶
Types ¶
type Batch ¶
type BqClient ¶
func (*BqClient) BulkGetDDLView ¶ added in v0.10.1
func (c *BqClient) BulkGetDDLView(ctx context.Context, pd ProjectDataset, names []string) (map[ResourceURN]string, error)
func (*BqClient) DatasetHandleFrom ¶
func (c *BqClient) DatasetHandleFrom(ds Dataset) ResourceHandle
func (*BqClient) ExternalTableHandleFrom ¶
func (c *BqClient) ExternalTableHandleFrom(ds Dataset, name string) ResourceHandle
func (*BqClient) ModelHandleFrom ¶ added in v0.16.0
func (c *BqClient) ModelHandleFrom(ds Dataset, name string) ResourceHandle
func (*BqClient) RoutineHandleFrom ¶ added in v0.13.1
func (c *BqClient) RoutineHandleFrom(ds Dataset, name string) ResourceHandle
func (*BqClient) TableHandleFrom ¶
func (c *BqClient) TableHandleFrom(ds Dataset, name string) TableResourceHandle
func (*BqClient) ViewHandleFrom ¶
func (c *BqClient) ViewHandleFrom(ds Dataset, name string) ResourceHandle
type BqClientProvider ¶
type BqClientProvider struct{}
func NewClientProvider ¶
func NewClientProvider() *BqClientProvider
type BqDataset ¶
type BqDataset interface { Create(context.Context, *bigquery.DatasetMetadata) error Update(context.Context, bigquery.DatasetMetadataToUpdate, string) (*bigquery.DatasetMetadata, error) Metadata(context.Context) (*bigquery.DatasetMetadata, error) }
type BqModel ¶ added in v0.16.0
type BqModel interface {
Metadata(ctx context.Context) (mm *bigquery.ModelMetadata, err error)
}
BqModel is BigQuery Model
type BqRoutine ¶ added in v0.13.1
type BqRoutine interface { Create(ctx context.Context, rm *bigquery.RoutineMetadata) (err error) Update(ctx context.Context, upd *bigquery.RoutineMetadataToUpdate, etag string) (rm *bigquery.RoutineMetadata, err error) Metadata(ctx context.Context) (*bigquery.RoutineMetadata, error) }
BqRoutine is including UDF, Store Procedure, Table Function
type BqTable ¶
type BqTable interface { Create(context.Context, *bigquery.TableMetadata) error Update(context.Context, bigquery.TableMetadataToUpdate, string, ...bigquery.TableUpdateOption) (*bigquery.TableMetadata, error) Metadata(ctx context.Context, opts ...bigquery.TableMetadataOption) (*bigquery.TableMetadata, error) CopierFrom(srcs ...*bigquery.Table) *bigquery.Copier }
type Client ¶
type Client interface { DatasetHandleFrom(dataset Dataset) ResourceHandle TableHandleFrom(dataset Dataset, name string) TableResourceHandle ExternalTableHandleFrom(dataset Dataset, name string) ResourceHandle ViewHandleFrom(dataset Dataset, name string) ResourceHandle RoutineHandleFrom(ds Dataset, name string) ResourceHandle ModelHandleFrom(ds Dataset, name string) ResourceHandle BulkGetDDLView(ctx context.Context, dataset ProjectDataset, names []string) (map[ResourceURN]string, error) Close() error }
type ClientProvider ¶
type DatasetDetails ¶
type DatasetDetails struct { Name resource.Name Description string `mapstructure:"description,omitempty"` ExtraConfig map[string]interface{} `mapstructure:",remain"` }
func (DatasetDetails) FullName ¶
func (d DatasetDetails) FullName() string
func (DatasetDetails) Validate ¶
func (DatasetDetails) Validate() error
type DatasetHandle ¶
type DatasetHandle struct {
// contains filtered or unexported fields
}
func NewDatasetHandle ¶
func NewDatasetHandle(ds BqDataset) *DatasetHandle
type ExternalSource ¶
type ExternalSource struct { SourceType string `mapstructure:"type,omitempty"` SourceURIs []string `mapstructure:"uris,omitempty"` // Additional configs for CSV, GoogleSheets, Bigtable, and Parquet formats. Config map[string]interface{} `mapstructure:"config"` }
func (ExternalSource) Validate ¶
func (e ExternalSource) Validate() error
type ExternalTable ¶
type ExternalTable struct { Name resource.Name Description string `mapstructure:"description,omitempty"` Schema Schema `mapstructure:"schema,omitempty"` Source *ExternalSource `mapstructure:"source,omitempty"` ExtraConfig map[string]interface{} `mapstructure:",remain"` }
func (*ExternalTable) FullName ¶
func (e *ExternalTable) FullName() string
func (*ExternalTable) Validate ¶
func (e *ExternalTable) Validate() error
type ExternalTableHandle ¶
type ExternalTableHandle struct {
// contains filtered or unexported fields
}
func NewExternalTableHandle ¶
func NewExternalTableHandle(bq BqTable) *ExternalTableHandle
type Field ¶
type Field struct { Name string `mapstructure:"name,omitempty"` Type string `mapstructure:"type,omitempty"` Description string `mapstructure:"description,omitempty"` Mode string `mapstructure:"mode,omitempty"` // optional sub-schema, when record type Schema Schema `mapstructure:"schema,omitempty"` }
type ModelHandle ¶ added in v0.16.0
type ModelHandle struct {
// contains filtered or unexported fields
}
func NewModelHandle ¶ added in v0.16.0
func NewModelHandle(bq BqModel) *ModelHandle
type Partition ¶
type ProjectDataset ¶ added in v0.10.1
type ResourceHandle ¶
type ResourceURN ¶ added in v0.10.1
type ResourceURN struct {
// contains filtered or unexported fields
}
func NewResourceURN ¶ added in v0.10.1
func NewResourceURN(project, dataset, name string) (ResourceURN, error)
func NewResourceURNFromString ¶ added in v0.10.1
func NewResourceURNFromString(urn string) (ResourceURN, error)
func (ResourceURN) Dataset ¶ added in v0.10.1
func (n ResourceURN) Dataset() string
func (ResourceURN) Name ¶ added in v0.10.1
func (n ResourceURN) Name() string
func (ResourceURN) Project ¶ added in v0.10.1
func (n ResourceURN) Project() string
func (ResourceURN) URN ¶ added in v0.10.1
func (n ResourceURN) URN() string
type ResourceURNWithUpstreams ¶ added in v0.10.2
type ResourceURNWithUpstreams struct { ResourceURN ResourceURN Upstreams []*ResourceURNWithUpstreams }
type ResourceURNWithUpstreamsList ¶ added in v0.10.2
type ResourceURNWithUpstreamsList []*ResourceURNWithUpstreams
func (ResourceURNWithUpstreamsList) FlattenUnique ¶ added in v0.10.2
func (rs ResourceURNWithUpstreamsList) FlattenUnique() []*ResourceURNWithUpstreams
type ResourceURNs ¶ added in v0.10.1
type ResourceURNs []ResourceURN
func (ResourceURNs) GroupByProjectDataset ¶ added in v0.10.1
func (n ResourceURNs) GroupByProjectDataset() map[ProjectDataset][]string
type RoutineHandle ¶ added in v0.13.1
type RoutineHandle struct {
// contains filtered or unexported fields
}
func NewRoutineHandle ¶ added in v0.13.1
func NewRoutineHandle(bq BqRoutine) *RoutineHandle
type SecretProvider ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewBigqueryDataStore ¶
func NewBigqueryDataStore(secretProvider SecretProvider, clientProvider ClientProvider) *Store
func (Store) BatchUpdate ¶
type Table ¶
type Table struct { Name resource.Name Description string `mapstructure:"description,omitempty"` Schema Schema `mapstructure:"schema,omitempty"` Cluster *Cluster `mapstructure:"cluster,omitempty"` Partition *Partition `mapstructure:"partition,omitempty"` ExtraConfig map[string]interface{} `mapstructure:",remain"` }
type TableHandle ¶
type TableHandle struct {
// contains filtered or unexported fields
}
func NewTableHandle ¶
func NewTableHandle(bq BqTable) *TableHandle
func (TableHandle) CopierFrom ¶
func (t TableHandle) CopierFrom(source TableResourceHandle) (TableCopier, error)
func (TableHandle) GetBQTable ¶
func (t TableHandle) GetBQTable() (*bigquery.Table, error)
func (TableHandle) UpdateExpiry ¶
type TableResourceHandle ¶
type TableResourceHandle interface { ResourceHandle GetBQTable() (*bq.Table, error) CopierFrom(source TableResourceHandle) (TableCopier, error) UpdateExpiry(ctx context.Context, name string, expiry time.Time) error }
type URNComponent ¶ added in v0.17.0
type View ¶
type ViewHandle ¶
type ViewHandle struct {
// contains filtered or unexported fields
}
func NewViewHandle ¶
func NewViewHandle(bq BqTable) *ViewHandle
Click to show internal directories.
Click to hide internal directories.