Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDumpHeader ¶
GenerateDumpHeader generates the header for database dumps with metadata
Types ¶
type ColumnDiff ¶
ColumnDiff represents changes to a column
func (*ColumnDiff) GetObjectName ¶
func (d *ColumnDiff) GetObjectName() string
type ConstraintDiff ¶
type ConstraintDiff struct {
Old *ir.Constraint
New *ir.Constraint
}
ConstraintDiff represents changes to a constraint
func (*ConstraintDiff) GetObjectName ¶
func (d *ConstraintDiff) GetObjectName() string
type Diff ¶
type Diff struct {
Statements []SQLStatement `json:"statements"`
Type DiffType `json:"type"`
Operation DiffOperation `json:"operation"` // create, alter, drop, replace
Path string `json:"path"`
Source DiffSource `json:"source,omitempty"`
}
Diff represents one or more related SQL statements with their source change
type DiffOperation ¶
type DiffOperation int
DiffOperation represents the operation being performed
const ( DiffOperationCreate DiffOperation = iota DiffOperationAlter DiffOperationDrop // DiffOperationRecreate indicates a DROP that is part of a DROP+CREATE cycle // for dependency handling. The object will be recreated, so this should be // counted as a modification in summaries, not a destruction. DiffOperationRecreate )
func (DiffOperation) MarshalJSON ¶
func (d DiffOperation) MarshalJSON() ([]byte, error)
MarshalJSON marshals DiffOperation to JSON as a string
func (DiffOperation) String ¶
func (d DiffOperation) String() string
String returns the string representation of DiffOperation
func (*DiffOperation) UnmarshalJSON ¶
func (d *DiffOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals DiffOperation from JSON string
type DiffSource ¶
type DiffSource interface {
GetObjectName() string // Returns the object name (preserves names with dots like "public.idx_users")
}
DiffSource represents all possible source types for a diff
type DiffType ¶
type DiffType int
DiffType represents the type of database object being changed
const ( DiffTypeTable DiffType = iota DiffTypeTableColumn DiffTypeTableIndex DiffTypeTableTrigger DiffTypeTablePolicy DiffTypeTableRLS DiffTypeTableConstraint DiffTypeTableComment DiffTypeTableColumnComment DiffTypeTableIndexComment DiffTypeView DiffTypeViewTrigger DiffTypeViewComment DiffTypeMaterializedView DiffTypeMaterializedViewComment DiffTypeMaterializedViewIndex DiffTypeMaterializedViewIndexComment DiffTypeFunction DiffTypeProcedure DiffTypeSequence DiffTypeType DiffTypeDomain DiffTypeComment DiffTypeDefaultPrivilege DiffTypePrivilege DiffTypeRevokedDefaultPrivilege DiffTypeColumnPrivilege )
func (DiffType) MarshalJSON ¶
MarshalJSON marshals DiffType to JSON as a string
func (*DiffType) UnmarshalJSON ¶
UnmarshalJSON unmarshals DiffType from JSON string
type SQLStatement ¶
type SQLStatement struct {
SQL string `json:"sql,omitempty"`
CanRunInTransaction bool `json:"can_run_in_transaction"`
}
SQLStatement represents a single SQL statement with its transaction capability