drivers

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Close() error
	Diff(ctx context.Context) (string, error)
}

type PostgresColumn

type PostgresColumn struct {
	Name    string
	Type    string
	NotNull bool
	Default sql.NullString
}

func (*PostgresColumn) Copy

func (c *PostgresColumn) Copy() *PostgresColumn

func (*PostgresColumn) HasEqualAttributes

func (c *PostgresColumn) HasEqualAttributes(other *PostgresColumn) bool

func (*PostgresColumn) String

func (c *PostgresColumn) String() string

type PostgresConstraint

type PostgresConstraint struct {
	Name string
	Type string // p (primary), u (unique), c (check), f (foreign)
	Def  string
}

func (*PostgresConstraint) String

func (c *PostgresConstraint) String() string

type PostgresDriver

type PostgresDriver struct {
	SourceDatabaseConnection *sql.DB
	TargetDatabaseConnection *sql.DB
}

func NewPostgresDriver

func NewPostgresDriver(config *PostgresDriverConfig) (*PostgresDriver, error)

func (*PostgresDriver) Close

func (d *PostgresDriver) Close() error

func (*PostgresDriver) Diff

func (d *PostgresDriver) Diff(ctx context.Context) (string, error)

func (*PostgresDriver) DiffTables

func (d *PostgresDriver) DiffTables(ctx context.Context) (string, error)

func (*PostgresDriver) DiffViews

func (d *PostgresDriver) DiffViews(ctx context.Context) (string, error)

func (*PostgresDriver) GetTable

func (d *PostgresDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*PostgresTable, error)

func (*PostgresDriver) GetTables

func (d *PostgresDriver) GetTables(ctx context.Context, db *sql.DB) ([]*PostgresTable, error)

func (*PostgresDriver) GetViews

func (d *PostgresDriver) GetViews(ctx context.Context, db *sql.DB) ([]*PostgresView, error)

type PostgresDriverConfig

type PostgresDriverConfig struct {
	SourceConnectionString string
	TargetConnectionString string
}

type PostgresIndex

type PostgresIndex struct {
	Name string
	Def  string
}

func (*PostgresIndex) String

func (i *PostgresIndex) String() string

type PostgresTable

type PostgresTable struct {
	Name        string
	Columns     []*PostgresColumn
	Indexes     []*PostgresIndex
	Constraints []*PostgresConstraint
	Triggers    []*PostgresTrigger
}

func (*PostgresTable) ColumnByName

func (t *PostgresTable) ColumnByName(name string) (*PostgresColumn, bool)

func (*PostgresTable) ConstraintByName

func (t *PostgresTable) ConstraintByName(name string) (*PostgresConstraint, bool)

func (*PostgresTable) DiffTable

func (t *PostgresTable) DiffTable(other *PostgresTable) (string, error)

func (*PostgresTable) IndexByName

func (t *PostgresTable) IndexByName(name string) (*PostgresIndex, bool)

func (*PostgresTable) String

func (t *PostgresTable) String() string

func (*PostgresTable) StringCreateTable

func (t *PostgresTable) StringCreateTable() string

func (*PostgresTable) TriggerByName

func (t *PostgresTable) TriggerByName(name string) (*PostgresTrigger, bool)

type PostgresTrigger

type PostgresTrigger struct {
	Name string
	Def  string
}

func (*PostgresTrigger) String

func (t *PostgresTrigger) String() string

type PostgresView

type PostgresView struct {
	Name string
	Def  string
}

func (*PostgresView) String

func (v *PostgresView) String() string

type SQLLiteDriverConfig

type SQLLiteDriverConfig struct {
	SourceDatabasePath string
	TargetDatabasePath string
}

type SQLiteColumn

type SQLiteColumn struct {
	Name       string
	Type       string
	NotNull    bool
	PrimaryKey bool
	Default    sql.NullString
}

func (*SQLiteColumn) Copy

func (c *SQLiteColumn) Copy() *SQLiteColumn

func (*SQLiteColumn) HasEqualAttributes

func (c *SQLiteColumn) HasEqualAttributes(other *SQLiteColumn) bool

func (*SQLiteColumn) IsTypeChangeCompatible

func (c *SQLiteColumn) IsTypeChangeCompatible(other *SQLiteColumn) bool

func (*SQLiteColumn) String

func (c *SQLiteColumn) String() string

type SQLiteDriver

type SQLiteDriver struct {
	SourceDatabaseConnection *sql.DB
	TargetDatabaseConnection *sql.DB
}

func NewSQLiteDriver

func NewSQLiteDriver(config *SQLLiteDriverConfig) (*SQLiteDriver, error)

func (*SQLiteDriver) Close

func (d *SQLiteDriver) Close() error

func (*SQLiteDriver) Diff

func (d *SQLiteDriver) Diff(ctx context.Context) (string, error)

func (*SQLiteDriver) DiffTables

func (d *SQLiteDriver) DiffTables(ctx context.Context) (string, error)

func (*SQLiteDriver) DiffViews

func (d *SQLiteDriver) DiffViews(ctx context.Context) (string, error)

func (*SQLiteDriver) GetIndexColumns

func (d *SQLiteDriver) GetIndexColumns(ctx context.Context, db *sql.DB, indexName string) ([]string, error)

func (*SQLiteDriver) GetTable

func (d *SQLiteDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*SQLiteTable, error)

func (*SQLiteDriver) GetTableColumns

func (d *SQLiteDriver) GetTableColumns(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteColumn, error)

func (*SQLiteDriver) GetTableForeignKeys

func (d *SQLiteDriver) GetTableForeignKeys(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteForeignKey, error)

func (*SQLiteDriver) GetTableIndexes

func (d *SQLiteDriver) GetTableIndexes(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteIndex, error)

func (*SQLiteDriver) GetTableTriggers

func (d *SQLiteDriver) GetTableTriggers(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteTrigger, error)

func (*SQLiteDriver) GetTables

func (d *SQLiteDriver) GetTables(ctx context.Context, db *sql.DB) ([]*SQLiteTable, error)

func (*SQLiteDriver) GetViews

func (d *SQLiteDriver) GetViews(ctx context.Context, db *sql.DB) ([]*SQLiteView, error)

type SQLiteForeignKey

type SQLiteForeignKey struct {
	Table    string
	From     []string
	To       []string
	OnUpdate string
	OnDelete string
}

func (*SQLiteForeignKey) Equal

func (fk *SQLiteForeignKey) Equal(other *SQLiteForeignKey) bool

func (*SQLiteForeignKey) String

func (fk *SQLiteForeignKey) String() string

type SQLiteIndex

type SQLiteIndex struct {
	Table   string
	Name    string
	Columns []string
	Unique  bool
}

func (*SQLiteIndex) Equal

func (i *SQLiteIndex) Equal(other *SQLiteIndex) bool

func (*SQLiteIndex) String

func (i *SQLiteIndex) String() string

type SQLiteTable

type SQLiteTable struct {
	Name        string
	Columns     []*SQLiteColumn
	Indexes     []*SQLiteIndex
	Triggers    []*SQLiteTrigger
	ForeignKeys []*SQLiteForeignKey
}

func (*SQLiteTable) ColumnByName

func (t *SQLiteTable) ColumnByName(name string) (*SQLiteColumn, bool)

func (*SQLiteTable) Copy

func (t *SQLiteTable) Copy() *SQLiteTable

func (*SQLiteTable) DiffColumns

func (t *SQLiteTable) DiffColumns(other *SQLiteTable) *SQLiteTableColumnsDiff

func (*SQLiteTable) DiffIndexes

func (t *SQLiteTable) DiffIndexes(other *SQLiteTable) (string, error)

func (*SQLiteTable) DiffTable

func (t *SQLiteTable) DiffTable(other *SQLiteTable) (string, error)

func (*SQLiteTable) DiffTriggers

func (t *SQLiteTable) DiffTriggers(other *SQLiteTable) (string, error)

func (*SQLiteTable) IndexByName

func (t *SQLiteTable) IndexByName(name string) (*SQLiteIndex, bool)

func (*SQLiteTable) String

func (t *SQLiteTable) String() string

func (*SQLiteTable) StringCreateIndexes

func (t *SQLiteTable) StringCreateIndexes() string

func (*SQLiteTable) StringCreateTable

func (t *SQLiteTable) StringCreateTable() string

func (*SQLiteTable) StringCreateTriggers

func (t *SQLiteTable) StringCreateTriggers() string

func (*SQLiteTable) TriggerByName

func (t *SQLiteTable) TriggerByName(name string) (*SQLiteTrigger, bool)

type SQLiteTableColumnsDiff

type SQLiteTableColumnsDiff struct {
	Added    []string
	Modified []string
	Removed  []string
	Renamed  map[string]string // oldName -> newName

	ForeignKeysChanged bool
}

type SQLiteTrigger

type SQLiteTrigger struct {
	Name string
	SQL  string
}

type SQLiteView

type SQLiteView struct {
	Name string
	SQL  string
}

func (*SQLiteView) Diff

func (v *SQLiteView) Diff(other *SQLiteView) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL