Documentation
¶
Index ¶
- func FormatDiff(result *DiffResult, format OutputFormat, w io.Writer) error
- type ColumnChange
- type ColumnDiff
- type ColumnSummary
- type ConstraintChange
- type ConstraintDiff
- type ConstraintSummary
- type DiffResult
- type IndexChange
- type IndexDiff
- type IndexSummary
- type OutputFormat
- type RelationshipChange
- type RelationshipDiff
- type RelationshipSummary
- type SchemaChange
- type SchemaDiff
- type SchemaSummary
- type SequenceChange
- type SequenceDiff
- type SequenceSummary
- type Summary
- type TableChange
- type TableDiff
- type TableSummary
- type ViewChange
- type ViewDiff
- type ViewSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDiff ¶
func FormatDiff(result *DiffResult, format OutputFormat, w io.Writer) error
FormatDiff formats the diff result according to the specified format
Types ¶
type ColumnChange ¶
type ColumnChange struct {
Name string `json:"name"`
Source *models.Column `json:"source"`
Target *models.Column `json:"target"`
Changes map[string]any `json:"changes"` // Map of field name to what changed
}
ColumnChange represents a modified column
type ColumnDiff ¶
type ColumnDiff struct {
Missing []*models.Column `json:"missing"` // Columns in source but not in target
Extra []*models.Column `json:"extra"` // Columns in target but not in source
Modified []*ColumnChange `json:"modified"` // Columns that exist in both but differ
}
ColumnDiff represents differences in columns
type ColumnSummary ¶
type ConstraintChange ¶
type ConstraintChange struct {
Name string `json:"name"`
Source *models.Constraint `json:"source"`
Target *models.Constraint `json:"target"`
Changes map[string]any `json:"changes"`
}
ConstraintChange represents a modified constraint
type ConstraintDiff ¶
type ConstraintDiff struct {
Missing []*models.Constraint `json:"missing"` // Constraints in source but not in target
Extra []*models.Constraint `json:"extra"` // Constraints in target but not in source
Modified []*ConstraintChange `json:"modified"` // Constraints that exist in both but differ
}
ConstraintDiff represents differences in constraints
type ConstraintSummary ¶
type DiffResult ¶
type DiffResult struct {
Source string `json:"source"`
Target string `json:"target"`
Schemas *SchemaDiff `json:"schemas"`
}
DiffResult represents the complete difference analysis between two databases
func CompareDatabases ¶
func CompareDatabases(source, target *models.Database) *DiffResult
CompareDatabases compares two database models and returns the differences
type IndexChange ¶
type IndexChange struct {
Name string `json:"name"`
Source *models.Index `json:"source"`
Target *models.Index `json:"target"`
Changes map[string]any `json:"changes"`
}
IndexChange represents a modified index
type IndexDiff ¶
type IndexDiff struct {
Missing []*models.Index `json:"missing"` // Indexes in source but not in target
Extra []*models.Index `json:"extra"` // Indexes in target but not in source
Modified []*IndexChange `json:"modified"` // Indexes that exist in both but differ
}
IndexDiff represents differences in indexes
type IndexSummary ¶
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format for diff results
const ( FormatSummary OutputFormat = "summary" FormatJSON OutputFormat = "json" FormatHTML OutputFormat = "html" )
type RelationshipChange ¶
type RelationshipChange struct {
Name string `json:"name"`
Source *models.Relationship `json:"source"`
Target *models.Relationship `json:"target"`
Changes map[string]any `json:"changes"`
}
RelationshipChange represents a modified relationship
type RelationshipDiff ¶
type RelationshipDiff struct {
Missing []*models.Relationship `json:"missing"` // Relationships in source but not in target
Extra []*models.Relationship `json:"extra"` // Relationships in target but not in source
Modified []*RelationshipChange `json:"modified"` // Relationships that exist in both but differ
}
RelationshipDiff represents differences in relationships
type RelationshipSummary ¶
type SchemaChange ¶
type SchemaChange struct {
Name string `json:"name"`
Tables *TableDiff `json:"tables,omitempty"`
Views *ViewDiff `json:"views,omitempty"`
Sequences *SequenceDiff `json:"sequences,omitempty"`
}
SchemaChange represents changes within a schema
type SchemaDiff ¶
type SchemaDiff struct {
Missing []*models.Schema `json:"missing"` // Schemas in source but not in target
Extra []*models.Schema `json:"extra"` // Schemas in target but not in source
Modified []*SchemaChange `json:"modified"` // Schemas that exist in both but differ
}
SchemaDiff represents differences at the schema level
type SchemaSummary ¶
type SequenceChange ¶
type SequenceChange struct {
Name string `json:"name"`
Source *models.Sequence `json:"source"`
Target *models.Sequence `json:"target"`
Changes map[string]any `json:"changes"`
}
SequenceChange represents a modified sequence
type SequenceDiff ¶
type SequenceDiff struct {
Missing []*models.Sequence `json:"missing"` // Sequences in source but not in target
Extra []*models.Sequence `json:"extra"` // Sequences in target but not in source
Modified []*SequenceChange `json:"modified"` // Sequences that exist in both but differ
}
SequenceDiff represents differences in sequences
type SequenceSummary ¶
type Summary ¶
type Summary struct {
Schemas SchemaSummary `json:"schemas"`
Tables TableSummary `json:"tables"`
Columns ColumnSummary `json:"columns"`
Indexes IndexSummary `json:"indexes"`
Constraints ConstraintSummary `json:"constraints"`
Relationships RelationshipSummary `json:"relationships"`
Views ViewSummary `json:"views"`
Sequences SequenceSummary `json:"sequences"`
}
Summary provides counts for quick overview
func ComputeSummary ¶
func ComputeSummary(result *DiffResult) *Summary
ComputeSummary generates a summary with counts from a DiffResult
type TableChange ¶
type TableChange struct {
Name string `json:"name"`
Schema string `json:"schema"`
Columns *ColumnDiff `json:"columns,omitempty"`
Indexes *IndexDiff `json:"indexes,omitempty"`
Constraints *ConstraintDiff `json:"constraints,omitempty"`
Relationships *RelationshipDiff `json:"relationships,omitempty"`
}
TableChange represents changes within a table
type TableDiff ¶
type TableDiff struct {
Missing []*models.Table `json:"missing"` // Tables in source but not in target
Extra []*models.Table `json:"extra"` // Tables in target but not in source
Modified []*TableChange `json:"modified"` // Tables that exist in both but differ
}
TableDiff represents differences in tables
type TableSummary ¶
type ViewChange ¶
type ViewChange struct {
Name string `json:"name"`
Source *models.View `json:"source"`
Target *models.View `json:"target"`
Changes map[string]any `json:"changes"`
}
ViewChange represents a modified view
type ViewDiff ¶
type ViewDiff struct {
Missing []*models.View `json:"missing"` // Views in source but not in target
Extra []*models.View `json:"extra"` // Views in target but not in source
Modified []*ViewChange `json:"modified"` // Views that exist in both but differ
}
ViewDiff represents differences in views