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(res *resource.Resource) (string, error)
- func URNFor(res *resource.Resource) (string, 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) TableHandleFrom(ds Dataset, name string) TableResourceHandle
- func (c *BqClient) ViewHandleFrom(ds Dataset, name string) ResourceHandle
- type BqClientProvider
- type BqDataset
- 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 Partition
- type ProjectDataset
- type Range
- type ResourceHandle
- type ResourceURN
- type ResourceURNWithUpstreams
- type ResourceURNWithUpstreamsList
- type ResourceURNs
- 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 (Store) GetURN(res *resource.Resource) (string, 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 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" )
View Source
const (
EntityExternalTable = "resource_external_table"
)
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) 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 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 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 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 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 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.