Documentation
¶
Index ¶
- func TableMetadataPath(req GetTableRequest) string
- func TableTypeStrings() []string
- type Client
- func (c *Client) Close() error
- func (c *Client) GetTable(ctx context.Context, req GetTableRequest) (*TableMetadata, error)
- func (c *Client) InsertRows(ctx context.Context, req InsertRowsRequest) (*InsertRowsResult, error)
- func (c *Client) ListDatasets(ctx context.Context, req ListDatasetsRequest) ([]Dataset, error)
- func (c *Client) ListTables(ctx context.Context, req ListTablesRequest) ([]Table, error)
- func (c *Client) Query(ctx context.Context, req QueryRequest) (*QueryResult, error)
- func (c *Client) QueryPages(ctx context.Context, req QueryRequest, consume func(*QueryResult) error) (retErr error)
- func (c *Client) TestConnection(ctx context.Context, req TestConnectionRequest) error
- type Config
- type Credentials
- type Dataset
- type Field
- type GetTableRequest
- type InsertRowsRequest
- type InsertRowsResult
- type ListDatasetsRequest
- type ListTablesRequest
- type QueryParameter
- type QueryRequest
- type QueryResult
- type Table
- type TableMetadata
- type TableType
- type TestConnectionRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TableMetadataPath ¶
func TableMetadataPath(req GetTableRequest) string
TableMetadataPath is also used by the Proof transport's exact route allowlist.
func TableTypeStrings ¶
func TableTypeStrings() []string
TableTypeStrings returns a slice of all String values of the enum
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client adapts the official BigQuery REST SDK to Braidplane resource policies.
func New ¶
New creates a BigQuery REST client from runtime configuration and write-only credentials.
func (*Client) GetTable ¶
func (c *Client) GetTable(ctx context.Context, req GetTableRequest) (*TableMetadata, error)
GetTable preserves observed identity and schema facts without inferred defaults.
func (*Client) InsertRows ¶
func (c *Client) InsertRows(ctx context.Context, req InsertRowsRequest) (*InsertRowsResult, error)
InsertRows appends rows with one insertAll attempt.
func (*Client) ListDatasets ¶
ListDatasets lists datasets within the schema quota.
func (*Client) ListTables ¶
ListTables lists tables within the schema quota.
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, req QueryRequest) (*QueryResult, error)
Query executes jobs.query within cumulative response and retained-row budgets.
func (*Client) QueryPages ¶
func (c *Client) QueryPages(ctx context.Context, req QueryRequest, consume func(*QueryResult) error) (retErr error)
QueryPages consumes bounded pages from one query job without retaining prior pages.
func (*Client) TestConnection ¶
func (c *Client) TestConnection(ctx context.Context, req TestConnectionRequest) error
TestConnection verifies credentials with a low-risk dataset request.
type Config ¶
type Config struct {
ProjectID string `json:"project_id" validate:"required,min=1"`
Location string `json:"location,omitempty" validate:"omitempty,min=1"`
DefaultDataset string `json:"default_dataset,omitempty" validate:"omitempty,min=1"`
TimeoutSeconds int `json:"timeout_seconds,omitempty" validate:"omitempty,min=1,max=300"`
MaximumBytesBilled int64 `json:"maximum_bytes_billed,omitempty" validate:"omitempty,min=1"`
BaseURL string `json:"base_url,omitempty" validate:"omitempty,url"`
TokenURL string `json:"token_url,omitempty" validate:"omitempty,url"`
AllowPrivateHosts bool `json:"allow_private_hosts,omitempty"`
}
Config holds BigQuery connector runtime configuration.
type Credentials ¶
type Credentials struct {
ServiceAccountJSON string `json:"service_account_json,omitempty" validate:"required_without=AccessToken,excluded_with=AccessToken"`
AccessToken string `json:"access_token,omitempty" validate:"required_without=ServiceAccountJSON,excluded_with=ServiceAccountJSON"`
}
Credentials holds a service-account key or an access token resolved by credentialssvc.
type Dataset ¶
type Dataset struct {
ID string
}
Dataset is a provider dataset reference normalized for the adapter.
type Field ¶
type Field struct {
Name string
Type string
Mode string
Precision string
Scale string
Fields []Field
}
Field describes one BigQuery result or table schema field.
type GetTableRequest ¶
GetTableRequest identifies a BigQuery table metadata request.
type InsertRowsRequest ¶
type InsertRowsRequest struct {
ProjectID string
DatasetID string
TableID string
InsertIDPrefix string
Rows []map[string]any
MaxRequestBytes int64
MaxResponseBytes int64
}
InsertRowsRequest describes an append-style BigQuery insertAll request.
type InsertRowsResult ¶
type InsertRowsResult struct {
InsertedRows int
}
InsertRowsResult reports the number of rows accepted by BigQuery.
type ListDatasetsRequest ¶
ListDatasetsRequest identifies the project whose datasets should be listed.
type ListTablesRequest ¶
ListTablesRequest identifies the dataset whose tables should be listed.
type QueryParameter ¶
QueryParameter is one BigQuery named query parameter.
type QueryRequest ¶
type QueryRequest struct {
ProjectID string
Location string
SQL string
Parameters []QueryParameter
Timeout time.Duration
MaximumBytesBilled int64
MaxResultRows int // Materialized row bound (with overflow sentinel), or streamed quota (0 disables).
MaxResponseBytes int64 // Cumulative provider bytes and a separate retained-row budget.
}
QueryRequest describes a BigQuery jobs.query request after Braidplane binding.
type QueryResult ¶
QueryResult contains provider rows up to the requested row cap.
type TableMetadata ¶
type TableMetadata struct {
ProjectID string
DatasetID string
TableID string
Type TableType
Fields []Field
}
TableMetadata preserves the observed resource identity, kind, and schema.
func ReadTableMetadata ¶
func ReadTableMetadata(ctx context.Context, transport *http.Client, creds Credentials, req GetTableRequest) (*TableMetadata, error)
ReadTableMetadata uses fixed provider/authentication endpoints and the caller's restricted client. Service-account token_uri cannot widen metadata egress.
type TableType ¶
type TableType int
TableType is the provider resource kind, not a guarantee of write access.
func TableTypeString ¶
TableTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func TableTypeValues ¶
func TableTypeValues() []TableType
TableTypeValues returns all values of the enum
func (TableType) IsATableType ¶
IsATableType returns "true" if the value is listed in the enum definition. "false" otherwise
func (TableType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for TableType
func (TableType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for TableType
func (*TableType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for TableType
func (*TableType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for TableType
type TestConnectionRequest ¶
TestConnectionRequest identifies the BigQuery project checked by connection tests.