Documentation
¶
Index ¶
- type ChangedDatabase
- type ChangedResources
- func (r *ChangedResources) AddFunction(database string, schema string, change *storepb.ChangedResourceFunction)
- func (r *ChangedResources) AddProcedure(database string, schema string, change *storepb.ChangedResourceProcedure)
- func (r *ChangedResources) AddTable(database string, schema string, change *storepb.ChangedResourceTable, ...)
- func (r *ChangedResources) AddView(database string, schema string, change *storepb.ChangedResourceView)
- func (r *ChangedResources) Build() *storepb.ChangedResources
- func (r *ChangedResources) CountAffectedTableRows() int64
- type ChangedSchema
- type ChangedTable
- type ColumnMetadata
- type DatabaseMetadata
- func (d *DatabaseMetadata) CreateSchema(schemaName string) *SchemaMetadata
- func (d *DatabaseMetadata) DatabaseName() string
- func (d *DatabaseMetadata) DropSchema(schemaName string) error
- func (d *DatabaseMetadata) GetConfig() *storepb.DatabaseConfig
- func (d *DatabaseMetadata) GetIsObjectCaseSensitive() bool
- func (d *DatabaseMetadata) GetLinkedDatabase(name string) *storepb.LinkedDatabaseMetadata
- func (d *DatabaseMetadata) GetProto() *storepb.DatabaseSchemaMetadata
- func (d *DatabaseMetadata) GetRawDump() []byte
- func (d *DatabaseMetadata) GetSchemaMetadata(name string) *SchemaMetadata
- func (d *DatabaseMetadata) GetSearchPath() []string
- func (d *DatabaseMetadata) HasNoTable() bool
- func (d *DatabaseMetadata) ListSchemaNames() []string
- func (d *DatabaseMetadata) NewSearcher(schemaName string) *DatabaseSearcher
- func (d *DatabaseMetadata) SearchExternalTable(searchPath []string, name string) (string, *ExternalTableMetadata)
- func (d *DatabaseMetadata) SearchFunctions(searchPath []string, name string) ([]string, []*storepb.FunctionMetadata)
- func (d *DatabaseMetadata) SearchIndex(searchPath []string, name string) (string, *IndexMetadata)
- func (d *DatabaseMetadata) SearchMaterializedView(searchPath []string, name string) (string, *storepb.MaterializedViewMetadata)
- func (d *DatabaseMetadata) SearchObject(searchPath []string, name string) (string, string)
- func (d *DatabaseMetadata) SearchSequence(searchPath []string, name string) (string, *storepb.SequenceMetadata)
- func (d *DatabaseMetadata) SearchTable(searchPath []string, name string) (string, *TableMetadata)
- func (d *DatabaseMetadata) SearchView(searchPath []string, name string) (string, *storepb.ViewMetadata)
- type DatabaseSearcher
- func (s *DatabaseSearcher) SearchExternalTable(name string) (string, *ExternalTableMetadata)
- func (s *DatabaseSearcher) SearchFunctions(name string) ([]string, []*storepb.FunctionMetadata)
- func (s *DatabaseSearcher) SearchIndex(name string) (string, *IndexMetadata)
- func (s *DatabaseSearcher) SearchMaterializedView(name string) (string, *storepb.MaterializedViewMetadata)
- func (s *DatabaseSearcher) SearchObject(name string) (string, string)
- func (s *DatabaseSearcher) SearchSequence(name string) (string, *storepb.SequenceMetadata)
- func (s *DatabaseSearcher) SearchTable(name string) (string, *TableMetadata)
- func (s *DatabaseSearcher) SearchView(name string) (string, *storepb.ViewMetadata)
- type ExternalTableMetadata
- type IndexMetadata
- type SchemaMetadata
- func (s *SchemaMetadata) CreateTable(tableName string) (*TableMetadata, error)
- func (s *SchemaMetadata) CreateView(viewName string, definition string, ...) (*storepb.ViewMetadata, error)
- func (s *SchemaMetadata) DropTable(tableName string) error
- func (s *SchemaMetadata) DropView(viewName string) error
- func (s *SchemaMetadata) GetCatalog() *storepb.SchemaCatalog
- func (s *SchemaMetadata) GetDependentViews(tableName string, columnName string) []string
- func (s *SchemaMetadata) GetExternalTable(name string) *ExternalTableMetadata
- func (s *SchemaMetadata) GetFunction(name string) *storepb.FunctionMetadata
- func (s *SchemaMetadata) GetIndex(name string) *IndexMetadata
- func (s *SchemaMetadata) GetMaterializedView(name string) *storepb.MaterializedViewMetadata
- func (s *SchemaMetadata) GetPackage(name string) *storepb.PackageMetadata
- func (s *SchemaMetadata) GetProcedure(name string) *storepb.ProcedureMetadata
- func (s *SchemaMetadata) GetProto() *storepb.SchemaMetadata
- func (s *SchemaMetadata) GetSequence(name string) *storepb.SequenceMetadata
- func (s *SchemaMetadata) GetSequencesByOwnerTable(name string) []*storepb.SequenceMetadata
- func (s *SchemaMetadata) GetTable(name string) *TableMetadata
- func (s *SchemaMetadata) GetView(name string) *storepb.ViewMetadata
- func (s *SchemaMetadata) ListForeignTableNames() []string
- func (s *SchemaMetadata) ListMaterializedViewNames() []string
- func (s *SchemaMetadata) ListProcedureNames() []string
- func (s *SchemaMetadata) ListTableNames() []string
- func (s *SchemaMetadata) ListViewNames() []string
- func (s *SchemaMetadata) RenameTable(oldName string, newName string) error
- func (s *SchemaMetadata) RenameView(oldName string, newName string) error
- type TableMetadata
- func (t *TableMetadata) CreateColumn(columnProto *storepb.ColumnMetadata, columnCatalog *storepb.ColumnCatalog) error
- func (t *TableMetadata) CreateIndex(indexProto *storepb.IndexMetadata) error
- func (t *TableMetadata) DropColumn(columnName string) error
- func (t *TableMetadata) DropColumnWithoutRenumbering(columnName string) error
- func (t *TableMetadata) DropColumnWithoutUpdatingIndexes(columnName string) error
- func (t *TableMetadata) DropIndex(indexName string) error
- func (t *TableMetadata) GetCatalog() *storepb.TableCatalog
- func (t *TableMetadata) GetColumn(name string) *ColumnMetadata
- func (t *TableMetadata) GetIndex(name string) *IndexMetadata
- func (t *TableMetadata) GetOwner() string
- func (t *TableMetadata) GetPrimaryKey() *IndexMetadata
- func (t *TableMetadata) GetProto() *storepb.TableMetadata
- func (t *TableMetadata) GetTableComment() string
- func (t *TableMetadata) ListIndexes() []*IndexMetadata
- func (t *TableMetadata) RenameColumn(oldName string, newName string) error
- func (t *TableMetadata) RenameIndex(oldName string, newName string) error
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangedDatabase ¶
type ChangedDatabase struct {
// contains filtered or unexported fields
}
type ChangedResources ¶
type ChangedResources struct {
// contains filtered or unexported fields
}
func NewChangedResources ¶
func NewChangedResources(dbMetadata *DatabaseMetadata) *ChangedResources
func (*ChangedResources) AddFunction ¶
func (r *ChangedResources) AddFunction(database string, schema string, change *storepb.ChangedResourceFunction)
func (*ChangedResources) AddProcedure ¶
func (r *ChangedResources) AddProcedure(database string, schema string, change *storepb.ChangedResourceProcedure)
func (*ChangedResources) AddTable ¶
func (r *ChangedResources) AddTable(database string, schema string, change *storepb.ChangedResourceTable, affectedTable bool)
func (*ChangedResources) AddView ¶
func (r *ChangedResources) AddView(database string, schema string, change *storepb.ChangedResourceView)
func (*ChangedResources) Build ¶
func (r *ChangedResources) Build() *storepb.ChangedResources
func (*ChangedResources) CountAffectedTableRows ¶
func (r *ChangedResources) CountAffectedTableRows() int64
type ChangedSchema ¶
type ChangedSchema struct {
// contains filtered or unexported fields
}
type ChangedTable ¶
type ChangedTable struct {
// contains filtered or unexported fields
}
type ColumnMetadata ¶
type ColumnMetadata struct {
// contains filtered or unexported fields
}
ColumnMetadata is the unified metadata for a column, combining proto metadata and catalog config.
func (*ColumnMetadata) GetCatalog ¶
func (c *ColumnMetadata) GetCatalog() *storepb.ColumnCatalog
func (*ColumnMetadata) GetProto ¶
func (c *ColumnMetadata) GetProto() *storepb.ColumnMetadata
type DatabaseMetadata ¶
type DatabaseMetadata struct {
// contains filtered or unexported fields
}
DatabaseMetadata is the unified database schema including metadata, config, and raw dump. This struct combines what were previously separate types: DatabaseMetadata, and DatabaseConfig.
func NewDatabaseMetadata ¶
func NewDatabaseMetadata( metadata *storepb.DatabaseSchemaMetadata, schema []byte, config *storepb.DatabaseConfig, engine storepb.Engine, isObjectCaseSensitive bool, ) *DatabaseMetadata
func (*DatabaseMetadata) CreateSchema ¶
func (d *DatabaseMetadata) CreateSchema(schemaName string) *SchemaMetadata
func (*DatabaseMetadata) DatabaseName ¶
func (d *DatabaseMetadata) DatabaseName() string
func (*DatabaseMetadata) DropSchema ¶
func (d *DatabaseMetadata) DropSchema(schemaName string) error
func (*DatabaseMetadata) GetConfig ¶
func (d *DatabaseMetadata) GetConfig() *storepb.DatabaseConfig
func (*DatabaseMetadata) GetIsObjectCaseSensitive ¶
func (d *DatabaseMetadata) GetIsObjectCaseSensitive() bool
func (*DatabaseMetadata) GetLinkedDatabase ¶
func (d *DatabaseMetadata) GetLinkedDatabase(name string) *storepb.LinkedDatabaseMetadata
func (*DatabaseMetadata) GetProto ¶
func (d *DatabaseMetadata) GetProto() *storepb.DatabaseSchemaMetadata
func (*DatabaseMetadata) GetRawDump ¶
func (d *DatabaseMetadata) GetRawDump() []byte
func (*DatabaseMetadata) GetSchemaMetadata ¶
func (d *DatabaseMetadata) GetSchemaMetadata(name string) *SchemaMetadata
func (*DatabaseMetadata) GetSearchPath ¶
func (d *DatabaseMetadata) GetSearchPath() []string
func (*DatabaseMetadata) HasNoTable ¶
func (d *DatabaseMetadata) HasNoTable() bool
func (*DatabaseMetadata) ListSchemaNames ¶
func (d *DatabaseMetadata) ListSchemaNames() []string
func (*DatabaseMetadata) NewSearcher ¶
func (d *DatabaseMetadata) NewSearcher(schemaName string) *DatabaseSearcher
NewSearcher creates a searcher for database objects. If schemaName is provided (non-empty), it searches only in that schema; otherwise uses the database's search path. If the database's search path is empty, defaults to ["public"] for PostgreSQL. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchExternalTable ¶
func (d *DatabaseMetadata) SearchExternalTable(searchPath []string, name string) (string, *ExternalTableMetadata)
SearchExternalTable searches for an external table in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchFunctions ¶
func (d *DatabaseMetadata) SearchFunctions(searchPath []string, name string) ([]string, []*storepb.FunctionMetadata)
SearchFunctions searches for functions in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchIndex ¶
func (d *DatabaseMetadata) SearchIndex(searchPath []string, name string) (string, *IndexMetadata)
SearchIndex searches for an index in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchMaterializedView ¶
func (d *DatabaseMetadata) SearchMaterializedView(searchPath []string, name string) (string, *storepb.MaterializedViewMetadata)
SearchMaterializedView searches for a materialized view in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchObject ¶
func (d *DatabaseMetadata) SearchObject(searchPath []string, name string) (string, string)
SearchObject searches for any database object in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchSequence ¶
func (d *DatabaseMetadata) SearchSequence(searchPath []string, name string) (string, *storepb.SequenceMetadata)
SearchSequence searches for a sequence in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchTable ¶
func (d *DatabaseMetadata) SearchTable(searchPath []string, name string) (string, *TableMetadata)
SearchTable searches for a table in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseMetadata) SearchView ¶
func (d *DatabaseMetadata) SearchView(searchPath []string, name string) (string, *storepb.ViewMetadata)
SearchView searches for a view in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
type DatabaseSearcher ¶
type DatabaseSearcher struct {
// contains filtered or unexported fields
}
DatabaseSearcher provides a fluent interface for searching database objects with a specific search path. This helper avoids repetitive searchPath parameter passing when performing multiple searches. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchExternalTable ¶
func (s *DatabaseSearcher) SearchExternalTable(name string) (string, *ExternalTableMetadata)
SearchExternalTable searches for an external table in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchFunctions ¶
func (s *DatabaseSearcher) SearchFunctions(name string) ([]string, []*storepb.FunctionMetadata)
SearchFunctions searches for functions in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchIndex ¶
func (s *DatabaseSearcher) SearchIndex(name string) (string, *IndexMetadata)
SearchIndex searches for an index in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchMaterializedView ¶
func (s *DatabaseSearcher) SearchMaterializedView(name string) (string, *storepb.MaterializedViewMetadata)
SearchMaterializedView searches for a materialized view in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchObject ¶
func (s *DatabaseSearcher) SearchObject(name string) (string, string)
SearchObject searches for any database object in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchSequence ¶
func (s *DatabaseSearcher) SearchSequence(name string) (string, *storepb.SequenceMetadata)
SearchSequence searches for a sequence in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchTable ¶
func (s *DatabaseSearcher) SearchTable(name string) (string, *TableMetadata)
SearchTable searches for a table in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
func (*DatabaseSearcher) SearchView ¶
func (s *DatabaseSearcher) SearchView(name string) (string, *storepb.ViewMetadata)
SearchView searches for a view in the search path. NOTE: This is primarily designed for PostgreSQL's search_path concept.
type ExternalTableMetadata ¶
type ExternalTableMetadata struct {
// contains filtered or unexported fields
}
ExternalTableMetadata is the metadata for a external table.
func (*ExternalTableMetadata) GetColumn ¶
func (t *ExternalTableMetadata) GetColumn(name string) *storepb.ColumnMetadata
GetColumn gets the column by name.
func (*ExternalTableMetadata) GetProto ¶
func (t *ExternalTableMetadata) GetProto() *storepb.ExternalTableMetadata
type IndexMetadata ¶
type IndexMetadata struct {
// contains filtered or unexported fields
}
func (*IndexMetadata) GetProto ¶
func (i *IndexMetadata) GetProto() *storepb.IndexMetadata
func (*IndexMetadata) GetTableProto ¶
func (i *IndexMetadata) GetTableProto() *storepb.TableMetadata
type SchemaMetadata ¶
type SchemaMetadata struct {
// contains filtered or unexported fields
}
SchemaMetadata is the unified metadata for a schema, combining proto metadata and catalog config.
func (*SchemaMetadata) CreateTable ¶
func (s *SchemaMetadata) CreateTable(tableName string) (*TableMetadata, error)
CreateTable creates a new table in the schema. Returns the created TableMetadata or an error if the table already exists.
func (*SchemaMetadata) CreateView ¶
func (s *SchemaMetadata) CreateView(viewName string, definition string, dependencyColumns []*storepb.DependencyColumn) (*storepb.ViewMetadata, error)
CreateView creates a new view in the schema. Returns an error if the view already exists.
func (*SchemaMetadata) DropTable ¶
func (s *SchemaMetadata) DropTable(tableName string) error
DropTable drops a table from the schema. Returns an error if the table does not exist.
func (*SchemaMetadata) DropView ¶
func (s *SchemaMetadata) DropView(viewName string) error
DropView drops a view from the schema. Returns an error if the view does not exist.
func (*SchemaMetadata) GetCatalog ¶
func (s *SchemaMetadata) GetCatalog() *storepb.SchemaCatalog
GetCatalog gets the catalog of SchemaMetadata.
func (*SchemaMetadata) GetDependentViews ¶
func (s *SchemaMetadata) GetDependentViews(tableName string, columnName string) []string
GetDependentViews returns all views that depend on the given table and column. This is used to check if a column can be dropped or if a table can be dropped.
func (*SchemaMetadata) GetExternalTable ¶
func (s *SchemaMetadata) GetExternalTable(name string) *ExternalTableMetadata
GetExternalTable gets the external table by name.
func (*SchemaMetadata) GetFunction ¶
func (s *SchemaMetadata) GetFunction(name string) *storepb.FunctionMetadata
GetFunction gets the function by name. Note: For overloaded functions, this returns the first match by name only. Use signature-based lookup for precise matching.
func (*SchemaMetadata) GetIndex ¶
func (s *SchemaMetadata) GetIndex(name string) *IndexMetadata
GetIndex gets the index by name. Index names are unique within a schema in most databases.
func (*SchemaMetadata) GetMaterializedView ¶
func (s *SchemaMetadata) GetMaterializedView(name string) *storepb.MaterializedViewMetadata
GetMaterializedView gets the materialized view by name.
func (*SchemaMetadata) GetPackage ¶
func (s *SchemaMetadata) GetPackage(name string) *storepb.PackageMetadata
func (*SchemaMetadata) GetProcedure ¶
func (s *SchemaMetadata) GetProcedure(name string) *storepb.ProcedureMetadata
func (*SchemaMetadata) GetProto ¶
func (s *SchemaMetadata) GetProto() *storepb.SchemaMetadata
GetProto gets the proto of SchemaMetadata.
func (*SchemaMetadata) GetSequence ¶
func (s *SchemaMetadata) GetSequence(name string) *storepb.SequenceMetadata
GetSequence gets the sequence by name.
func (*SchemaMetadata) GetSequencesByOwnerTable ¶
func (s *SchemaMetadata) GetSequencesByOwnerTable(name string) []*storepb.SequenceMetadata
func (*SchemaMetadata) GetTable ¶
func (s *SchemaMetadata) GetTable(name string) *TableMetadata
GetTable gets the schema by name.
func (*SchemaMetadata) GetView ¶
func (s *SchemaMetadata) GetView(name string) *storepb.ViewMetadata
GetView gets the view by name.
func (*SchemaMetadata) ListForeignTableNames ¶
func (s *SchemaMetadata) ListForeignTableNames() []string
ListForeignTableNames lists the foreign table names.
func (*SchemaMetadata) ListMaterializedViewNames ¶
func (s *SchemaMetadata) ListMaterializedViewNames() []string
ListMaterializedViewNames lists the materialized view names.
func (*SchemaMetadata) ListProcedureNames ¶
func (s *SchemaMetadata) ListProcedureNames() []string
ListProcedureNames lists the procedure names.
func (*SchemaMetadata) ListTableNames ¶
func (s *SchemaMetadata) ListTableNames() []string
ListTableNames lists the table names.
func (*SchemaMetadata) ListViewNames ¶
func (s *SchemaMetadata) ListViewNames() []string
ListViewNames lists the view names.
func (*SchemaMetadata) RenameTable ¶
func (s *SchemaMetadata) RenameTable(oldName string, newName string) error
RenameTable renames a table in the schema. Returns an error if the old table doesn't exist or new table already exists.
func (*SchemaMetadata) RenameView ¶
func (s *SchemaMetadata) RenameView(oldName string, newName string) error
RenameView renames a view in the schema. Returns an error if the old view doesn't exist or new view already exists.
type TableMetadata ¶
type TableMetadata struct {
// contains filtered or unexported fields
}
TableMetadata is the unified metadata for a table, combining proto metadata and catalog config.
func (*TableMetadata) CreateColumn ¶
func (t *TableMetadata) CreateColumn(columnProto *storepb.ColumnMetadata, columnCatalog *storepb.ColumnCatalog) error
CreateColumn creates a new column in the table. Returns an error if the column already exists.
func (*TableMetadata) CreateIndex ¶
func (t *TableMetadata) CreateIndex(indexProto *storepb.IndexMetadata) error
CreateIndex creates a new index in the table. Returns an error if the index already exists.
func (*TableMetadata) DropColumn ¶
func (t *TableMetadata) DropColumn(columnName string) error
DropColumn drops a column from the table. Returns an error if the column does not exist.
func (*TableMetadata) DropColumnWithoutRenumbering ¶
func (t *TableMetadata) DropColumnWithoutRenumbering(columnName string) error
DropColumnWithoutRenumbering drops a column from the table without renumbering positions. This is used for PostgreSQL where column positions are stable (attnum) and shouldn't be renumbered. Returns an error if the column doesn't exist.
func (*TableMetadata) DropColumnWithoutUpdatingIndexes ¶
func (t *TableMetadata) DropColumnWithoutUpdatingIndexes(columnName string) error
DropColumnWithoutUpdatingIndexes drops a column from the table without updating index expressions. This is used when changing a column definition (MODIFY/CHANGE COLUMN) where we want to: 1. Drop the old column from the column list 2. Manually rename it in index expressions 3. Create a new column with the new definition Returns an error if the column doesn't exist.
func (*TableMetadata) DropIndex ¶
func (t *TableMetadata) DropIndex(indexName string) error
DropIndex drops an index from the table. Returns an error if the index does not exist.
func (*TableMetadata) GetCatalog ¶
func (t *TableMetadata) GetCatalog() *storepb.TableCatalog
func (*TableMetadata) GetColumn ¶
func (t *TableMetadata) GetColumn(name string) *ColumnMetadata
GetColumn gets the column by name.
func (*TableMetadata) GetIndex ¶
func (t *TableMetadata) GetIndex(name string) *IndexMetadata
func (*TableMetadata) GetOwner ¶
func (t *TableMetadata) GetOwner() string
func (*TableMetadata) GetPrimaryKey ¶
func (t *TableMetadata) GetPrimaryKey() *IndexMetadata
func (*TableMetadata) GetProto ¶
func (t *TableMetadata) GetProto() *storepb.TableMetadata
func (*TableMetadata) GetTableComment ¶
func (t *TableMetadata) GetTableComment() string
func (*TableMetadata) ListIndexes ¶
func (t *TableMetadata) ListIndexes() []*IndexMetadata
func (*TableMetadata) RenameColumn ¶
func (t *TableMetadata) RenameColumn(oldName string, newName string) error
RenameColumn renames a column in the table. Returns an error if the old column doesn't exist or new column already exists.
func (*TableMetadata) RenameIndex ¶
func (t *TableMetadata) RenameIndex(oldName string, newName string) error
RenameIndex renames an index in the table. Returns an error if the old index doesn't exist or new index already exists.
type Version ¶
type Version struct {
// contains filtered or unexported fields
}