Documentation
¶
Index ¶
- Variables
- func InitGoogleSQL() error
- func RowTypeFromAnalyzerOutput(out *googlesql.AnalyzerOutput, schema *Catalog) (*spannerpb.StructType, error)
- func RowTypeFromResolvedQuery(query *googlesql.ResolvedQueryStmt, schema *Catalog) (*spannerpb.StructType, error)
- func SpannerTypeFromGoogleSQLType(t googlesql.Googlesql_TypeNode) (*spannerpb.Type, error)
- func TypeFromAnalyzerOutput(out *googlesql.AnalyzerOutput) (*spannerpb.Type, error)
- type Analyzer
- func NewAnalyzer(schema *Catalog) (*Analyzer, error)
- func NewAnalyzerFromDDL(path, ddlSQL string) (*Analyzer, error)
- func NewAnalyzerFromDDLWithOptions(path, ddlSQL string, options ...AnalyzerOption) (*Analyzer, error)
- func NewAnalyzerFromDDLWithProtoDescriptorFiles(path, ddlSQL string, protoDescriptorPaths []string) (*Analyzer, error)
- func NewAnalyzerFromDDLWithProtoDescriptorFilesAndOptions(path, ddlSQL string, protoDescriptorPaths []string, options ...AnalyzerOption) (*Analyzer, error)
- func NewAnalyzerFromGoogleSQLCatalog(googleSQLCatalog *GoogleSQLCatalog) (*Analyzer, error)
- func NewAnalyzerWithOptions(schema *Catalog, options ...AnalyzerOption) (*Analyzer, error)
- func (a *Analyzer) AddPositionalQueryParameter(spec *TypeSpec) error
- func (a *Analyzer) AddQueryParameter(name string, spec *TypeSpec) error
- func (a *Analyzer) FunctionCatalogDebugString(verbose bool) (string, error)
- func (a *Analyzer) ParseDebugString(sqlMode, sql string) (string, error)
- func (a *Analyzer) ResolvedASTDebugString(sqlMode, sql string) (string, error)
- func (a *Analyzer) RowTypeForExpression(sql string) (*spannerpb.StructType, error)
- func (a *Analyzer) RowTypeForStatement(sql string) (*spannerpb.StructType, error)
- func (a *Analyzer) TypeForExpression(sql string) (*spannerpb.Type, error)
- func (a *Analyzer) Unparse(sqlMode, sql string) (string, error)
- type AnalyzerOption
- func WithFoldLiteralCast(enabled bool) AnalyzerOption
- func WithMaximumDevelopmentLanguageFeatures(enabled bool) AnalyzerOption
- func WithParseLocationRecordType(recordType googlesql.ParseLocationRecordType) AnalyzerOption
- func WithProductMode(mode googlesql.ProductMode) AnalyzerOption
- func WithPruneUnusedColumns(enabled bool) AnalyzerOption
- func WithStrictNameResolution(enabled bool) AnalyzerOption
- type BigQueryAnalyzer
- func (a *BigQueryAnalyzer) AddQueryParameter(name string, spec *TypeSpec) error
- func (a *BigQueryAnalyzer) AddSpannerExternalDataset(dataset, spannerSource string, catalog *Catalog) (*BigQuerySpannerExternalDatasetBinding, error)
- func (a *BigQueryAnalyzer) AddSpannerExternalDatasetWithOptions(dataset, spannerSource string, catalog *Catalog, ...) (*BigQuerySpannerExternalDatasetBinding, error)
- func (a *BigQueryAnalyzer) ParseDebugString(sqlMode, sql string) (string, error)
- func (a *BigQueryAnalyzer) ResolvedASTDebugString(sqlMode, sql string) (string, error)
- func (a *BigQueryAnalyzer) SetExternalQueryAnalyzers(analyzers map[string]*Analyzer)
- func (a *BigQueryAnalyzer) TableSchemaForExpression(sql string) (*BigQueryTableSchema, error)
- func (a *BigQueryAnalyzer) TableSchemaForStatement(sql string) (*BigQueryTableSchema, error)
- func (a *BigQueryAnalyzer) Unparse(sqlMode, sql string) (string, error)
- type BigQueryDataPolicyOption
- type BigQueryDatasetReference
- type BigQueryFieldElementType
- type BigQueryGoogleSQLCatalog
- type BigQueryPolicyTags
- type BigQuerySpannerExternalDatasetBinding
- type BigQuerySpannerExternalDatasetCloudResourceConnectionMetadata
- type BigQuerySpannerExternalDatasetColumn
- type BigQuerySpannerExternalDatasetExecution
- type BigQuerySpannerExternalDatasetLocationMetadata
- type BigQuerySpannerExternalDatasetOptions
- type BigQuerySpannerExternalDatasetProjectionMatrix
- type BigQuerySpannerExternalDatasetProjectionMatrixRow
- type BigQuerySpannerExternalDatasetProjectionPolicy
- type BigQuerySpannerExternalDatasetTable
- type BigQuerySpannerExternalDatasetVerification
- type BigQueryTableFieldSchema
- type BigQueryTableSchema
- type Catalog
- type Column
- type GoogleSQLCatalog
- type GoogleSQLHelper
- func (h *GoogleSQLHelper) AnalyzeExpression(sql string) (*googlesql.AnalyzerOutput, error)
- func (h *GoogleSQLHelper) AnalyzeStatement(sql string) (*googlesql.AnalyzerOutput, error)
- func (h *GoogleSQLHelper) Parse(sqlMode, sql string) (*googlesql.ParserOutput, error)
- func (h *GoogleSQLHelper) ParseDebugString(sqlMode, sql string) (string, error)
- func (h *GoogleSQLHelper) ResolvedASTDebugString(sqlMode, sql string) (string, error)
- func (h *GoogleSQLHelper) Unparse(sqlMode, sql string) (string, error)
- type GraphDerivedProperty
- type GraphElement
- type GraphEndpoint
- type GraphLabelProperties
- type GraphProperties
- type Index
- type KeyPart
- type Model
- type ModelColumn
- type ObjectName
- type PropertyGraph
- type ProtoDescriptorSet
- type QueryCodegenDiagnosticError
- type QueryCodegenPlanVetSuppression
- type QueryCodegenPlanWarning
- type Sequence
- type StructField
- type Table
- type TypeSpec
- type View
Constants ¶
This section is empty.
Variables ¶
var ErrStatementHasNoRowType = errors.New("statement has no row type")
Functions ¶
func InitGoogleSQL ¶
func InitGoogleSQL() error
func RowTypeFromAnalyzerOutput ¶
func RowTypeFromAnalyzerOutput(out *googlesql.AnalyzerOutput, schema *Catalog) (*spannerpb.StructType, error)
func RowTypeFromResolvedQuery ¶
func RowTypeFromResolvedQuery(query *googlesql.ResolvedQueryStmt, schema *Catalog) (*spannerpb.StructType, error)
func SpannerTypeFromGoogleSQLType ¶
func SpannerTypeFromGoogleSQLType(t googlesql.Googlesql_TypeNode) (*spannerpb.Type, error)
func TypeFromAnalyzerOutput ¶
func TypeFromAnalyzerOutput(out *googlesql.AnalyzerOutput) (*spannerpb.Type, error)
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func NewAnalyzer ¶
func NewAnalyzerFromDDL ¶
func NewAnalyzerFromDDLWithOptions ¶
func NewAnalyzerFromDDLWithOptions(path, ddlSQL string, options ...AnalyzerOption) (*Analyzer, error)
func NewAnalyzerFromDDLWithProtoDescriptorFilesAndOptions ¶
func NewAnalyzerFromDDLWithProtoDescriptorFilesAndOptions(path, ddlSQL string, protoDescriptorPaths []string, options ...AnalyzerOption) (*Analyzer, error)
func NewAnalyzerFromGoogleSQLCatalog ¶
func NewAnalyzerFromGoogleSQLCatalog(googleSQLCatalog *GoogleSQLCatalog) (*Analyzer, error)
func NewAnalyzerWithOptions ¶
func NewAnalyzerWithOptions(schema *Catalog, options ...AnalyzerOption) (*Analyzer, error)
func (*Analyzer) AddPositionalQueryParameter ¶
func (*Analyzer) AddQueryParameter ¶
func (*Analyzer) FunctionCatalogDebugString ¶
func (*Analyzer) ParseDebugString ¶
func (*Analyzer) ResolvedASTDebugString ¶
func (*Analyzer) RowTypeForExpression ¶
func (a *Analyzer) RowTypeForExpression(sql string) (*spannerpb.StructType, error)
func (*Analyzer) RowTypeForStatement ¶
func (a *Analyzer) RowTypeForStatement(sql string) (*spannerpb.StructType, error)
func (*Analyzer) TypeForExpression ¶
type AnalyzerOption ¶
type AnalyzerOption func(*analyzerConfig)
func WithFoldLiteralCast ¶
func WithFoldLiteralCast(enabled bool) AnalyzerOption
func WithMaximumDevelopmentLanguageFeatures ¶
func WithMaximumDevelopmentLanguageFeatures(enabled bool) AnalyzerOption
func WithParseLocationRecordType ¶
func WithParseLocationRecordType(recordType googlesql.ParseLocationRecordType) AnalyzerOption
func WithProductMode ¶
func WithProductMode(mode googlesql.ProductMode) AnalyzerOption
func WithPruneUnusedColumns ¶
func WithPruneUnusedColumns(enabled bool) AnalyzerOption
func WithStrictNameResolution ¶
func WithStrictNameResolution(enabled bool) AnalyzerOption
type BigQueryAnalyzer ¶
type BigQueryAnalyzer struct {
// contains filtered or unexported fields
}
BigQueryAnalyzer analyzes BigQuery GoogleSQL statements and returns BigQuery REST TableSchema-shaped metadata.
func NewBigQueryAnalyzerFromDDL ¶
func NewBigQueryAnalyzerFromDDL(path, ddlSQL string, options ...AnalyzerOption) (*BigQueryAnalyzer, error)
NewBigQueryAnalyzerFromDDL builds a BigQuery analyzer from BigQuery DDL.
func NewBigQueryAnalyzerFromGoogleSQLCatalog ¶
func NewBigQueryAnalyzerFromGoogleSQLCatalog(catalog *BigQueryGoogleSQLCatalog) (*BigQueryAnalyzer, error)
NewBigQueryAnalyzerFromGoogleSQLCatalog wraps an existing BigQuery GoogleSQL catalog.
func (*BigQueryAnalyzer) AddQueryParameter ¶
func (a *BigQueryAnalyzer) AddQueryParameter(name string, spec *TypeSpec) error
func (*BigQueryAnalyzer) AddSpannerExternalDataset ¶
func (a *BigQueryAnalyzer) AddSpannerExternalDataset(dataset, spannerSource string, catalog *Catalog) (*BigQuerySpannerExternalDatasetBinding, error)
AddSpannerExternalDataset registers a BigQuery-visible projection of Spanner tables under dataset. It models BigQuery Spanner external datasets for static analysis only; it does not create BigQuery datasets or Spanner connections.
func (*BigQueryAnalyzer) AddSpannerExternalDatasetWithOptions ¶
func (a *BigQueryAnalyzer) AddSpannerExternalDatasetWithOptions(dataset, spannerSource string, catalog *Catalog, options BigQuerySpannerExternalDatasetOptions) (*BigQuerySpannerExternalDatasetBinding, error)
AddSpannerExternalDatasetWithOptions registers a BigQuery-visible projection of Spanner tables under dataset with explicit static-analysis metadata.
func (*BigQueryAnalyzer) ParseDebugString ¶
func (a *BigQueryAnalyzer) ParseDebugString(sqlMode, sql string) (string, error)
ParseDebugString returns the parser AST debug string.
func (*BigQueryAnalyzer) ResolvedASTDebugString ¶
func (a *BigQueryAnalyzer) ResolvedASTDebugString(sqlMode, sql string) (string, error)
ResolvedASTDebugString returns the resolved AST debug string.
func (*BigQueryAnalyzer) SetExternalQueryAnalyzers ¶
func (a *BigQueryAnalyzer) SetExternalQueryAnalyzers(analyzers map[string]*Analyzer)
SetExternalQueryAnalyzers sets Spanner analyzers keyed by BigQuery connection ID for EXTERNAL_QUERY result schema inference.
func (*BigQueryAnalyzer) TableSchemaForExpression ¶
func (a *BigQueryAnalyzer) TableSchemaForExpression(sql string) (*BigQueryTableSchema, error)
TableSchemaForExpression analyzes a single expression and returns a one-field BigQuery TableSchema-shaped result schema.
func (*BigQueryAnalyzer) TableSchemaForStatement ¶
func (a *BigQueryAnalyzer) TableSchemaForStatement(sql string) (*BigQueryTableSchema, error)
TableSchemaForStatement analyzes a query statement and returns a BigQuery REST TableSchema-shaped result schema.
type BigQueryDataPolicyOption ¶
type BigQueryDataPolicyOption struct {
Name string `json:"name,omitempty"`
}
BigQueryDataPolicyOption mirrors the REST dataPolicies entry shape.
type BigQueryFieldElementType ¶
type BigQueryFieldElementType struct {
Type string `json:"type,omitempty"`
}
BigQueryFieldElementType mirrors the REST fieldElementType object used by RANGE fields.
type BigQueryGoogleSQLCatalog ¶
type BigQueryGoogleSQLCatalog struct {
SimpleCatalog *googlesql.SimpleCatalog
AnalyzerOptions *googlesql.AnalyzerOptions
TypeFactory *googlesql.TypeFactory
// contains filtered or unexported fields
}
BigQueryGoogleSQLCatalog contains a GoogleSQL frontend catalog built from BigQuery DDL.
func BuildBigQueryGoogleSQLCatalogFromDDL ¶
func BuildBigQueryGoogleSQLCatalogFromDDL(path, ddlSQL string, options ...AnalyzerOption) (*BigQueryGoogleSQLCatalog, error)
BuildBigQueryGoogleSQLCatalogFromDDL analyzes BigQuery DDL and registers its tables and views in a GoogleSQL frontend catalog.
func (*BigQueryGoogleSQLCatalog) Helper ¶
func (c *BigQueryGoogleSQLCatalog) Helper() *GoogleSQLHelper
Helper returns a reusable GoogleSQL helper for this catalog.
type BigQueryPolicyTags ¶
type BigQueryPolicyTags struct {
Names []string `json:"names,omitempty"`
}
BigQueryPolicyTags mirrors the REST policyTags object.
type BigQuerySpannerExternalDatasetBinding ¶
type BigQuerySpannerExternalDatasetBinding struct {
Kind string `json:"kind" yaml:"kind"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
BigQueryDataset string `json:"bigquery_dataset" yaml:"bigquery_dataset"`
BigQueryDatasetRef BigQueryDatasetReference `json:"bigquery_dataset_ref" yaml:"bigquery_dataset_ref"`
SpannerSource string `json:"spanner_source" yaml:"spanner_source"`
SourceSchema string `json:"source_schema" yaml:"source_schema"`
ExternalSource string `json:"external_source,omitempty" yaml:"external_source,omitempty"`
Location string `json:"location,omitempty" yaml:"location,omitempty"`
LocationMetadata *BigQuerySpannerExternalDatasetLocationMetadata `json:"location_metadata,omitempty" yaml:"location_metadata,omitempty"`
Connection string `json:"connection,omitempty" yaml:"connection,omitempty"`
CloudResourceConnection string `json:"cloud_resource_connection,omitempty" yaml:"cloud_resource_connection,omitempty"`
CloudResourceConnectionMetadata *BigQuerySpannerExternalDatasetCloudResourceConnectionMetadata `json:"cloud_resource_connection_metadata,omitempty" yaml:"cloud_resource_connection_metadata,omitempty"`
Access string `json:"access_mode,omitempty" yaml:"access_mode,omitempty"`
DatabaseRole string `json:"database_role,omitempty" yaml:"database_role,omitempty"`
DatabaseRoleSource string `json:"database_role_source,omitempty" yaml:"database_role_source,omitempty"`
AccessVerification BigQuerySpannerExternalDatasetVerification `json:"access_verification" yaml:"access_verification"`
RequiresDataBoostAccess bool `json:"requires_databoost_access" yaml:"requires_databoost_access"`
ProjectionPolicy BigQuerySpannerExternalDatasetProjectionPolicy `json:"projection_policy" yaml:"projection_policy"`
ProjectionMatrix BigQuerySpannerExternalDatasetProjectionMatrix `json:"projection_matrix" yaml:"projection_matrix"`
Execution BigQuerySpannerExternalDatasetExecution `json:"execution" yaml:"execution"`
Limitations []string `json:"limitations,omitempty" yaml:"limitations,omitempty"`
Warnings []QueryCodegenPlanWarning `json:"warnings,omitempty" yaml:"warnings,omitempty"`
VetSuppressions []QueryCodegenPlanVetSuppression `json:"vet_suppressions,omitempty" yaml:"vet_suppressions,omitempty"`
ProjectedTables []BigQuerySpannerExternalDatasetTable `json:"projected_tables,omitempty" yaml:"projected_tables,omitempty"`
}
type BigQuerySpannerExternalDatasetCloudResourceConnectionMetadata ¶
type BigQuerySpannerExternalDatasetCloudResourceConnectionMetadata struct {
ID string `json:"id,omitempty" yaml:"id,omitempty"`
ParsedLocation string `json:"parsed_location,omitempty" yaml:"parsed_location,omitempty"`
ParsedLocationCanonical string `json:"parsed_location_canonical,omitempty" yaml:"parsed_location_canonical,omitempty"`
LocationMatch bool `json:"location_match,omitempty" yaml:"location_match,omitempty"`
}
type BigQuerySpannerExternalDatasetColumn ¶
type BigQuerySpannerExternalDatasetColumn struct {
Name string `json:"name" yaml:"name"`
SpannerType string `json:"spanner_type,omitempty" yaml:"spanner_type,omitempty"`
BigQueryType string `json:"bigquery_type,omitempty" yaml:"bigquery_type,omitempty"`
Visible bool `json:"visible" yaml:"visible"`
VisibleInBigQueryMetadata bool `json:"visible_in_bigquery_metadata" yaml:"visible_in_bigquery_metadata"`
UnderlyingSpannerPrimaryKey bool `json:"underlying_spanner_primary_key,omitempty" yaml:"underlying_spanner_primary_key,omitempty"`
BigQueryKeyMetadataVisible bool `json:"bigquery_key_metadata_visible" yaml:"bigquery_key_metadata_visible"`
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
}
type BigQuerySpannerExternalDatasetOptions ¶
type BigQuerySpannerExternalDatasetOptions struct {
Project string
DefaultProject string
ExternalSource string
Location string
Connection string
CloudResourceConnection string
Access string
DatabaseRole string
DatabaseRoleSource string
AccessVerificationStatus string
AccessVerificationSource string
AccessVerificationHint string
AccessVerification BigQuerySpannerExternalDatasetVerification
UnsupportedColumns string
NamedSchemaPolicy string
}
type BigQuerySpannerExternalDatasetProjectionMatrix ¶
type BigQuerySpannerExternalDatasetProjectionMatrix struct {
Source string `json:"source" yaml:"source"`
SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"`
DocsLastUpdated string `json:"docs_last_updated,omitempty" yaml:"docs_last_updated,omitempty"`
DocsLastChecked string `json:"docs_last_checked,omitempty" yaml:"docs_last_checked,omitempty"`
GeneratorMatrixVersion int `json:"generator_matrix_version" yaml:"generator_matrix_version"`
Rows []BigQuerySpannerExternalDatasetProjectionMatrixRow `json:"rows,omitempty" yaml:"rows,omitempty"`
}
type BigQuerySpannerExternalDatasetProjectionMatrixRow ¶
type BigQuerySpannerExternalDatasetProjectionMatrixRow struct {
Object string `json:"object" yaml:"object"`
Behavior string `json:"behavior" yaml:"behavior"`
DefaultSeverity string `json:"default_severity" yaml:"default_severity"`
EvidenceKind string `json:"evidence_kind" yaml:"evidence_kind"`
SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"`
}
type BigQuerySpannerExternalDatasetTable ¶
type BigQuerySpannerExternalDatasetTable struct {
Name string `json:"name" yaml:"name"`
BigQueryTable string `json:"bigquery_table" yaml:"bigquery_table"`
SourceTable string `json:"source_table" yaml:"source_table"`
SpannerTable string `json:"spanner_table" yaml:"spanner_table"`
Visible bool `json:"visible" yaml:"visible"`
VisibleInBigQueryMetadata bool `json:"visible_in_bigquery_metadata" yaml:"visible_in_bigquery_metadata"`
BigQueryKeyMetadataVisible bool `json:"bigquery_key_metadata_visible" yaml:"bigquery_key_metadata_visible"`
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
NameMatching string `json:"name_matching,omitempty" yaml:"name_matching,omitempty"`
Columns []BigQuerySpannerExternalDatasetColumn `json:"columns,omitempty" yaml:"columns,omitempty"`
}
type BigQuerySpannerExternalDatasetVerification ¶
type BigQuerySpannerExternalDatasetVerification struct {
Status string `json:"status" yaml:"status"`
Source string `json:"source" yaml:"source"`
ConfiguredHint string `json:"configured_hint,omitempty" yaml:"configured_hint,omitempty"`
CheckedAt string `json:"checked_at,omitempty" yaml:"checked_at,omitempty"`
Verifier string `json:"verifier,omitempty" yaml:"verifier,omitempty"`
EvidenceDigest string `json:"evidence_digest,omitempty" yaml:"evidence_digest,omitempty"`
IndependentlyVerifiedByGenerator bool `json:"independently_verified_by_generator" yaml:"independently_verified_by_generator"`
Volatile bool `json:"volatile,omitempty" yaml:"volatile,omitempty"`
}
type BigQueryTableFieldSchema ¶
type BigQueryTableFieldSchema struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Mode string `json:"mode,omitempty"`
Fields []*BigQueryTableFieldSchema `json:"fields,omitempty"`
RangeElementType *BigQueryFieldElementType `json:"rangeElementType,omitempty"`
Description string `json:"description,omitempty"`
MaxLength string `json:"maxLength,omitempty"`
Precision string `json:"precision,omitempty"`
Scale string `json:"scale,omitempty"`
Collation string `json:"collation,omitempty"`
DefaultValueExpr string `json:"defaultValueExpression,omitempty"`
PolicyTags *BigQueryPolicyTags `json:"policyTags,omitempty"`
DataPolicies []*BigQueryDataPolicyOption `json:"dataPolicies,omitempty"`
RoundingMode string `json:"roundingMode,omitempty"`
}
BigQueryTableFieldSchema mirrors the BigQuery REST TableFieldSchema JSON shape for fields this project can infer from GoogleSQL analyzer types.
func BigQueryTableFieldSchemaFromExpressionAnalyzerOutput ¶
func BigQueryTableFieldSchemaFromExpressionAnalyzerOutput(name string, out *googlesql.AnalyzerOutput) (*BigQueryTableFieldSchema, error)
BigQueryTableFieldSchemaFromExpressionAnalyzerOutput converts a resolved expression to a BigQuery REST TableFieldSchema-shaped field.
func BigQueryTableFieldSchemaFromGoogleSQLType ¶
func BigQueryTableFieldSchemaFromGoogleSQLType(name string, typ googlesql.Googlesql_TypeNode) (*BigQueryTableFieldSchema, error)
BigQueryTableFieldSchemaFromGoogleSQLType converts a GoogleSQL frontend type to a BigQuery REST TableFieldSchema-shaped field.
type BigQueryTableSchema ¶
type BigQueryTableSchema struct {
Fields []*BigQueryTableFieldSchema `json:"fields,omitempty"`
}
BigQueryTableSchema mirrors the BigQuery REST TableSchema JSON shape.
func BigQueryTableSchemaFromAnalyzerOutput ¶
func BigQueryTableSchemaFromAnalyzerOutput(out *googlesql.AnalyzerOutput) (*BigQueryTableSchema, error)
BigQueryTableSchemaFromAnalyzerOutput converts a resolved query statement to a BigQuery REST TableSchema-shaped schema.
func BigQueryTableSchemaFromResolvedQuery ¶
func BigQueryTableSchemaFromResolvedQuery(query *googlesql.ResolvedQueryStmt) (*BigQueryTableSchema, error)
BigQueryTableSchemaFromResolvedQuery converts a resolved query to a BigQuery REST TableSchema-shaped schema.
type Catalog ¶
type Catalog struct {
Tables map[string]*Table
Indexes map[string]*Index
Views map[string]*View
ViewOrder []string
PropertyGraphs map[string]*PropertyGraph
Sequences map[string]*Sequence
Models map[string]*Model
ProtoTypes map[string]bool
ProtoDescriptors *ProtoDescriptorSet
}
func BuildSchemaCatalog ¶
func (*Catalog) LoadProtoDescriptorSetFiles ¶
type GoogleSQLCatalog ¶
type GoogleSQLCatalog struct {
SpannerCatalog *Catalog
SimpleCatalog *googlesql.SimpleCatalog
AnalyzerOptions *googlesql.AnalyzerOptions
TypeFactory *googlesql.TypeFactory
DescriptorPool *googlesql.DescriptorPool
// contains filtered or unexported fields
}
func BuildGoogleSQLCatalogFromDDL ¶
func BuildGoogleSQLCatalogFromDDL(path, ddlSQL string, protoDescriptorPaths []string, options ...AnalyzerOption) (*GoogleSQLCatalog, error)
func BuildGoogleSQLCatalogFromSpannerCatalog ¶
func BuildGoogleSQLCatalogFromSpannerCatalog(schema *Catalog, options ...AnalyzerOption) (*GoogleSQLCatalog, error)
func (*GoogleSQLCatalog) FunctionCatalogDebugString ¶
func (c *GoogleSQLCatalog) FunctionCatalogDebugString(verbose bool) (string, error)
func (*GoogleSQLCatalog) Helper ¶
func (c *GoogleSQLCatalog) Helper() *GoogleSQLHelper
func (*GoogleSQLCatalog) TypeSpecToGoogleSQLType ¶
func (c *GoogleSQLCatalog) TypeSpecToGoogleSQLType(spec *TypeSpec) (googlesql.Googlesql_TypeNode, error)
type GoogleSQLHelper ¶
type GoogleSQLHelper struct {
Catalog *googlesql.SimpleCatalog
Options *googlesql.AnalyzerOptions
TypeFactory *googlesql.TypeFactory
}
func (*GoogleSQLHelper) AnalyzeExpression ¶
func (h *GoogleSQLHelper) AnalyzeExpression(sql string) (*googlesql.AnalyzerOutput, error)
func (*GoogleSQLHelper) AnalyzeStatement ¶
func (h *GoogleSQLHelper) AnalyzeStatement(sql string) (*googlesql.AnalyzerOutput, error)
func (*GoogleSQLHelper) Parse ¶
func (h *GoogleSQLHelper) Parse(sqlMode, sql string) (*googlesql.ParserOutput, error)
func (*GoogleSQLHelper) ParseDebugString ¶
func (h *GoogleSQLHelper) ParseDebugString(sqlMode, sql string) (string, error)
func (*GoogleSQLHelper) ResolvedASTDebugString ¶
func (h *GoogleSQLHelper) ResolvedASTDebugString(sqlMode, sql string) (string, error)
type GraphDerivedProperty ¶
type GraphElement ¶
type GraphElement struct {
Name string
Alias string
KeyColumns []string
Source *GraphEndpoint
Destination *GraphEndpoint
Labels []*GraphLabelProperties
Properties *GraphProperties
PropertiesSQL string
DynamicLabel string
DynamicProperties string
}
type GraphEndpoint ¶
type GraphLabelProperties ¶
type GraphLabelProperties struct {
Name string
Default bool
Properties *GraphProperties
PropertiesSQL string
}
type GraphProperties ¶
type GraphProperties struct {
NoProperties bool
AllColumns bool
ExceptColumns []string
DerivedProperties []*GraphDerivedProperty
}
type Index ¶
type Index struct {
Name ObjectName
TableName ObjectName
Keys []*KeyPart
StoredColumns []string
NullFiltered bool
}
type Model ¶
type Model struct {
Name string
Inputs []*ModelColumn
Outputs []*ModelColumn
}
type ModelColumn ¶
type ObjectName ¶
type ObjectName struct {
Parts []string
}
func (ObjectName) String ¶
func (n ObjectName) String() string
type PropertyGraph ¶
type PropertyGraph struct {
Name string
RawSQL string
NodeTables []*GraphElement
EdgeTables []*GraphElement
}
type ProtoDescriptorSet ¶
type ProtoDescriptorSet struct {
// contains filtered or unexported fields
}
func LoadProtoDescriptorSetFiles ¶
func LoadProtoDescriptorSetFiles(paths []string) (*ProtoDescriptorSet, error)
type QueryCodegenDiagnosticError ¶
type QueryCodegenDiagnosticError struct {
ID string
Stage string
Subject string
Message string
Err error
}
func (QueryCodegenDiagnosticError) Error ¶
func (e QueryCodegenDiagnosticError) Error() string
func (QueryCodegenDiagnosticError) Unwrap ¶
func (e QueryCodegenDiagnosticError) Unwrap() error
type QueryCodegenPlanWarning ¶
type Sequence ¶
type Sequence struct {
Name ObjectName
}
type StructField ¶
type Table ¶
type Table struct {
Name ObjectName
Columns []*Column
PrimaryKey []*KeyPart
Synonyms []string
}
type TypeSpec ¶
type TypeSpec struct {
Code spannerpb.TypeCode
Tokenlist bool
ArrayElement *TypeSpec
StructFields []StructField
ProtoTypeFQN string
Length *int64
Max bool
}
TypeSpec is this package's internal schema type representation.
It intentionally sits between Spanner DDL, the GoogleSQL frontend type system, and spannerpb.Type. Spanner DDL contains details that either are not representable in ResultSet Type metadata or are needed before descriptor resolution, such as TOKENLIST columns, STRING/BYTES length modifiers, STRING(MAX), and named proto or enum references from PROTO BUNDLE. Keeping those details here lets the catalog build GoogleSQL analyzer types first and convert only final analyzer results to spannerpb.Type.
func ParseTypeSpec ¶
type View ¶
type View struct {
Name ObjectName
Query string
}
Source Files
¶
- analyzer.go
- bigquery.go
- bigquery_external_query.go
- catalog.go
- function_catalog.go
- googlesql_catalog.go
- googlesql_helper.go
- googlesql_proto.go
- information_schema.go
- ml_predict.go
- models.go
- options.go
- propertygraph.go
- protobundle.go
- querygen_shared.go
- resultconv.go
- spanner_function_named_args.go
- spanner_functions.go
- spanner_sys.go
- spannerpb.go
- typeconv.go
- typespec_parse.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
spanner-analyzer
command
|
|
|
spanner-function-catalog
command
|
|
|
internal
|
|
|
optparam
Package optparam models optional query parameters that drive dynamic SQL generation at codegen time.
|
Package optparam models optional query parameters that drive dynamic SQL generation at codegen time. |
|
plancontract
module
|