Documentation
¶
Index ¶
- Variables
- func DatasetNameWithRandomPostfix(name string) string
- type AccessEntry
- type AccessRole
- type Client
- func (c *Client) AddAndSetTablePolicy(ctx context.Context, projectID, datasetID, tableID, role, member string) error
- func (c *Client) AddDatasetRoleAccessEntry(ctx context.Context, projectID, datasetID string, input *AccessEntry) error
- func (c *Client) AddDatasetViewAccessEntry(ctx context.Context, projectID, datasetID string, input *View) error
- func (c *Client) CreateDataset(ctx context.Context, projectID, datasetID, region string) error
- func (c *Client) CreateDatasetIfNotExists(ctx context.Context, projectID, datasetID, region string) error
- func (c *Client) CreateTable(ctx context.Context, input *Table) error
- func (c *Client) CreateTableOrUpdate(ctx context.Context, input *Table) (*Table, error)
- func (c *Client) DeleteDataset(ctx context.Context, project, datasetID string, deleteContents bool) error
- func (c *Client) DeleteTable(ctx context.Context, project, datasetID, tableID string) error
- func (c *Client) GetDataset(ctx context.Context, projectID, datasetID string) (*Dataset, error)
- func (c *Client) GetDatasets(ctx context.Context, projectID string) ([]*Dataset, error)
- func (c *Client) GetTable(ctx context.Context, projectID, datasetID, tableID string) (*Table, error)
- func (c *Client) GetTables(ctx context.Context, projectID, datasetID string) ([]*Table, error)
- func (c *Client) QueryAndWait(ctx context.Context, projectID, query string) (*JobStatistics, error)
- func (c *Client) RemoveAndSetTablePolicy(ctx context.Context, projectID, datasetID, tableID, role, member string) error
- type Column
- type ColumnMode
- type Dataset
- type EntityType
- type FieldType
- type JobStatistics
- type Operations
- type Table
- type TableType
- type View
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExist = errors.New("already exists") ErrNotExist = errors.New("not exists") )
Functions ¶
func DatasetNameWithRandomPostfix ¶
Generate unique name for dataset: - https://cloud.google.com/bigquery/docs/datasets#dataset-naming
Types ¶
type AccessEntry ¶
type AccessEntry struct {
Role AccessRole
EntityType EntityType
Entity string
View *View
}
func (AccessEntry) Validate ¶
func (a AccessEntry) Validate() error
type AccessRole ¶
type AccessRole string
AccessRole is the level of access to grant to a dataset.
const ( // OwnerRole is the OWNER AccessRole. OwnerRole AccessRole = "OWNER" // ReaderRole is the READER AccessRole. ReaderRole AccessRole = "READER" // WriterRole is the WRITER AccessRole. WriterRole AccessRole = "WRITER" BigQueryMetadataViewerRole AccessRole = "roles/bigquery.metadataViewer" BigQueryDataViewerRole AccessRole = "roles/bigquery.dataViewer" )
func (AccessRole) String ¶
func (r AccessRole) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddAndSetTablePolicy ¶
func (*Client) AddDatasetRoleAccessEntry ¶
func (*Client) AddDatasetViewAccessEntry ¶
func (*Client) CreateDataset ¶
func (*Client) CreateDatasetIfNotExists ¶
func (*Client) CreateTableOrUpdate ¶
func (*Client) DeleteDataset ¶
func (*Client) DeleteTable ¶
func (*Client) GetDataset ¶
func (*Client) GetDatasets ¶
func (*Client) QueryAndWait ¶
type ColumnMode ¶
type ColumnMode string
const ( NullableMode ColumnMode = "NULLABLE" RequiredMode ColumnMode = "REQUIRED" RepeatedMode ColumnMode = "REPEATED" )
func (*ColumnMode) String ¶
func (c *ColumnMode) String() string
type Dataset ¶
type Dataset struct {
ProjectID string
DatasetID string
Name string
Description string
Access []*AccessEntry
}
type EntityType ¶
type EntityType string
const ( UserEmailEntity EntityType = "user" GroupEmailEntity EntityType = "group" ViewEntity EntityType = "view" )
func (EntityType) String ¶
func (e EntityType) String() string
type FieldType ¶
type FieldType string
const ( // StringFieldType is a string field type. StringFieldType FieldType = "STRING" // BytesFieldType is a bytes field type. BytesFieldType FieldType = "BYTES" // IntegerFieldType is a integer field type. IntegerFieldType FieldType = "INTEGER" // FloatFieldType is a float field type. FloatFieldType FieldType = "FLOAT" // BooleanFieldType is a boolean field type. BooleanFieldType FieldType = "BOOLEAN" // TimestampFieldType is a timestamp field type. TimestampFieldType FieldType = "TIMESTAMP" // RecordFieldType is a record field type. It is typically used to create columns with repeated or nested data. RecordFieldType FieldType = "RECORD" // DateFieldType is a date field type. DateFieldType FieldType = "DATE" // TimeFieldType is a time field type. TimeFieldType FieldType = "TIME" // DateTimeFieldType is a datetime field type. DateTimeFieldType FieldType = "DATETIME" // NumericFieldType is a numeric field type. Numeric types include integer types, floating point types and the // NUMERIC data type. NumericFieldType FieldType = "NUMERIC" // GeographyFieldType is a string field type. Geography types represent a set of points // on the Earth's surface, represented in Well Known Text (WKT) format. GeographyFieldType FieldType = "GEOGRAPHY" // BigNumericFieldType is a numeric field type that supports values of larger precision // and scale than the NumericFieldType. BigNumericFieldType FieldType = "BIGNUMERIC" // IntervalFieldType is a representation of a duration or an amount of time. IntervalFieldType FieldType = "INTERVAL" // JSONFieldType is a representation of a json object. JSONFieldType FieldType = "JSON" // RangeFieldType represents a continuous range of values. RangeFieldType FieldType = "RANGE" )
type JobStatistics ¶
type Operations ¶
type Operations interface {
GetDataset(ctx context.Context, projectID, datasetID string) (*Dataset, error)
GetDatasets(ctx context.Context, projectID string) ([]*Dataset, error)
GetTable(ctx context.Context, projectID, datasetID, tableID string) (*Table, error)
GetTables(ctx context.Context, projectID, datasetID string) ([]*Table, error)
CreateDataset(ctx context.Context, projectID, datasetID, region string) error
CreateDatasetIfNotExists(ctx context.Context, projectID, datasetID, region string) error
CreateTable(ctx context.Context, input *Table) error
CreateTableOrUpdate(ctx context.Context, input *Table) (*Table, error)
DeleteTable(ctx context.Context, projectID, datasetID, tableID string) error
DeleteDataset(ctx context.Context, projectID, datasetID string, deleteContents bool) error
QueryAndWait(ctx context.Context, projectID, query string) (*JobStatistics, error)
AddDatasetRoleAccessEntry(ctx context.Context, projectID, datasetID string, input *AccessEntry) error
AddDatasetViewAccessEntry(ctx context.Context, projectID, datasetID string, view *View) error
AddAndSetTablePolicy(ctx context.Context, projectID, datasetID, tableID, role, member string) error
RemoveAndSetTablePolicy(ctx context.Context, projectID, datasetID, tableID, role, member string) error
}
type Table ¶
type Table struct {
ProjectID string
DatasetID string
TableID string
Location string
Name string
Description string
Type TableType
// The table schema. If provided on create, ViewQuery must be empty.
Schema []*Column
// The query to use for a logical view. If provided on create, Schema must be nil.
ViewQuery string
LastModified time.Time
Created time.Time
Expires time.Time
// contains filtered or unexported fields
}
type TableType ¶
type TableType string
const ( // RegularTable is a regular table. RegularTable TableType = "TABLE" // ViewTable is a table type describing that the table is a logical view. // See more information at https://cloud.google.com//docs/views. ViewTable TableType = "VIEW" // ExternalTable is a table type describing that the table is an external // table (also known as a federated data source). See more information at // https://cloud.google.com/bigquery/external-data-sources. ExternalTable TableType = "EXTERNAL" // MaterializedView represents a managed storage table that's derived from // a base table. MaterializedView TableType = "MATERIALIZED_VIEW" // Snapshot represents an immutable point in time snapshot of some other // table. Snapshot TableType = "SNAPSHOT" )
Click to show internal directories.
Click to hide internal directories.