Versions in this module Expand all Collapse all v1 v1.6.1 Dec 6, 2021 Changes in this version + var FlavorMariaDB101 = Flavor + var FlavorMariaDB102 = Flavor + var FlavorMariaDB103 = Flavor + var FlavorMariaDB104 = Flavor + var FlavorMariaDB105 = Flavor + var FlavorMariaDB106 = Flavor + var FlavorMySQL55 = Flavor + var FlavorMySQL56 = Flavor + var FlavorMySQL57 = Flavor + var FlavorMySQL80 = Flavor + var FlavorPercona55 = Flavor + var FlavorPercona56 = Flavor + var FlavorPercona57 = Flavor + var FlavorPercona80 = Flavor + var FlavorUnknown = Flavor + func ContainerNameForImage(image string) string + func EscapeIdentifier(input string) string + func EscapeValueForCreateTable(input string) string + func IsAccessError(err error) bool + func IsDatabaseError(err error, specificErrors ...uint16) bool + func IsForbiddenDiff(err error) bool + func IsSyntaxError(err error) bool + func IsUnsupportedDiff(err error) bool + func NormalizeCreateOptions(createStmt string) string + func ParseCreateAutoInc(createStmt string) (string, uint64) + func ParseCreatePartitioning(createStmt string) (base, partitionClause string) + func ParseVersion(version string) (result [3]int) + func RunSuite(suite IntegrationTestSuite, t *testing.T, backends []string) + func SplitEnv(key string) []string + func SplitHostOptionalPort(hostaddr string) (string, int, error) + func StripDisplayWidth(colType string) string + func UseFilteredDriverLogger() + type AddCheck struct + Check *Check + func (acc AddCheck) Clause(mods StatementModifiers) string + type AddColumn struct + Column *Column + PositionAfter *Column + PositionFirst bool + Table *Table + func (ac AddColumn) Clause(mods StatementModifiers) string + type AddForeignKey struct + ForeignKey *ForeignKey + func (afk AddForeignKey) Clause(mods StatementModifiers) string + type AddIndex struct + Index *Index + func (ai AddIndex) Clause(mods StatementModifiers) string + type AlterCheck struct + Check *Check + NewEnforcement bool + func (alcc AlterCheck) Clause(mods StatementModifiers) string + type AlterIndex struct + Index *Index + NewInvisible bool + func (ai AlterIndex) Clause(mods StatementModifiers) string + type BulkDropOptions struct + MaxConcurrency int + OnlyIfEmpty bool + PartitionsFirst bool + Schema *Schema + SkipBinlog bool + func (opts BulkDropOptions) Concurrency() int + type ChangeAutoIncrement struct + NewNextAutoIncrement uint64 + OldNextAutoIncrement uint64 + func (cai ChangeAutoIncrement) Clause(mods StatementModifiers) string + type ChangeCharSet struct + CharSet string + Collation string + func (ccs ChangeCharSet) Clause(_ StatementModifiers) string + type ChangeComment struct + NewComment string + func (cc ChangeComment) Clause(_ StatementModifiers) string + type ChangeCreateOptions struct + NewCreateOptions string + OldCreateOptions string + func (cco ChangeCreateOptions) Clause(_ StatementModifiers) string + type ChangeStorageEngine struct + NewStorageEngine string + func (cse ChangeStorageEngine) Clause(_ StatementModifiers) string + func (cse ChangeStorageEngine) Unsafe() bool + type Check struct + Clause string + Enforced bool + Name string + func (cc *Check) Definition(flavor Flavor) string + type Column struct + AutoIncrement bool + CharSet string + CheckClause string + Collation string + CollationIsDefault bool + Comment string + Compression string + Default string + GenerationExpr string + Invisible bool + Name string + Nullable bool + OnUpdate string + TypeInDB string + Virtual bool + func (c *Column) Definition(flavor Flavor, table *Table) string + func (c *Column) Equals(other *Column) bool + type DatabaseDiff struct + From *Schema + To *Schema + func (dd *DatabaseDiff) DiffType() DiffType + func (dd *DatabaseDiff) ObjectKey() ObjectKey + func (dd *DatabaseDiff) Statement(_ StatementModifiers) (string, error) + type DefKeyer interface + Def func() string + type DiffType int + const DiffTypeAlter + const DiffTypeCreate + const DiffTypeDrop + const DiffTypeNone + const DiffTypeRename + func (dt DiffType) String() string + type DockerClient struct + Options DockerClientOptions + func NewDockerClient(opts DockerClientOptions) (*DockerClient, error) + func (dc *DockerClient) CreateInstance(opts DockerizedInstanceOptions) (*DockerizedInstance, error) + func (dc *DockerClient) GetInstance(opts DockerizedInstanceOptions) (*DockerizedInstance, error) + func (dc *DockerClient) GetOrCreateInstance(opts DockerizedInstanceOptions) (*DockerizedInstance, error) + func (dc *DockerClient) ServerArchitecture() (string, error) + type DockerClientOptions struct + type DockerizedInstance struct + Manager *DockerClient + func (di *DockerizedInstance) DSN() string + func (di *DockerizedInstance) Destroy() error + func (di *DockerizedInstance) NukeData() error + func (di *DockerizedInstance) Port() int + func (di *DockerizedInstance) SourceSQL(filePath string) (string, error) + func (di *DockerizedInstance) Start() error + func (di *DockerizedInstance) Stop() error + func (di *DockerizedInstance) String() string + func (di *DockerizedInstance) TryConnect() (err error) + type DockerizedInstanceOptions struct + DefaultConnParams string + Image string + Name string + RootPassword string + type DropCheck struct + Check *Check + func (dcc DropCheck) Clause(mods StatementModifiers) string + type DropColumn struct + Column *Column + func (dc DropColumn) Clause(_ StatementModifiers) string + func (dc DropColumn) Unsafe() bool + type DropForeignKey struct + ForeignKey *ForeignKey + func (dfk DropForeignKey) Clause(mods StatementModifiers) string + type DropIndex struct + Index *Index + func (di DropIndex) Clause(mods StatementModifiers) string + type Flavor struct + Major int + Minor int + Patch int + Vendor Vendor + func NewFlavor(base string, versionParts ...int) Flavor + func ParseFlavor(versionString, versionComment string) Flavor + func (fl Flavor) AllowBlobDefaults() bool + func (fl Flavor) AlwaysShowTableCollation(charSet string) bool + func (fl Flavor) DefaultUtf8mb4Collation() string + func (fl Flavor) Family() Flavor + func (fl Flavor) FractionalTimestamps() bool + func (fl Flavor) GeneratedColumns() bool + func (fl Flavor) HasCheckConstraints() bool + func (fl Flavor) HasDataDictionary() bool + func (fl Flavor) Known() bool + func (fl Flavor) MySQLishMinVersion(versionParts ...int) bool + func (fl Flavor) OmitIntDisplayWidth() bool + func (fl Flavor) SortedForeignKeys() bool + func (fl Flavor) String() string + func (fl Flavor) Supported() bool + func (fl Flavor) VendorMinVersion(vendor Vendor, versionParts ...int) bool + type ForbiddenDiffError struct + Reason string + Statement string + func (e *ForbiddenDiffError) Error() string + type ForeignKey struct + ColumnNames []string + DeleteRule string + Name string + ReferencedColumnNames []string + ReferencedSchemaName string + ReferencedTableName string + UpdateRule string + func (fk *ForeignKey) Definition(flavor Flavor) string + func (fk *ForeignKey) Equals(other *ForeignKey) bool + func (fk *ForeignKey) Equivalent(other *ForeignKey) bool + type Index struct + Comment string + FullTextParser string + Invisible bool + Name string + Parts []IndexPart + PrimaryKey bool + Type string + Unique bool + func (idx *Index) Definition(flavor Flavor) string + func (idx *Index) Equals(other *Index) bool + func (idx *Index) EqualsIgnoringVisibility(other *Index) bool + func (idx *Index) Equivalent(other *Index) bool + func (idx *Index) RedundantTo(other *Index) bool + type IndexPart struct + ColumnName string + Descending bool + Expression string + PrefixLength uint16 + func (part *IndexPart) Definition(_ Flavor) string + type Instance struct + BaseDSN string + Driver string + Host string + Password string + Port int + SocketPath string + User string + func NewInstance(driver, dsn string) (*Instance, error) + func (instance *Instance) AlterSchema(schema string, opts SchemaCreationOptions) error + func (instance *Instance) CachedConnectionPool(defaultSchema, params string) (*sqlx.DB, error) + func (instance *Instance) CanConnect() (bool, error) + func (instance *Instance) CanSkipBinlog() bool + func (instance *Instance) CloseAll() + func (instance *Instance) Connect(defaultSchema string, params string) (*sqlx.DB, error) + func (instance *Instance) ConnectionPool(defaultSchema, params string) (*sqlx.DB, error) + func (instance *Instance) CreateSchema(name string, opts SchemaCreationOptions) (*Schema, error) + func (instance *Instance) DefaultCharSetAndCollation() (serverCharSet, serverCollation string, err error) + func (instance *Instance) DropRoutinesInSchema(schema string, opts BulkDropOptions) error + func (instance *Instance) DropSchema(schema string, opts BulkDropOptions) error + func (instance *Instance) DropTablesInSchema(schema string, opts BulkDropOptions) error + func (instance *Instance) Flavor() Flavor + func (instance *Instance) ForceFlavor(flavor Flavor) + func (instance *Instance) HasSchema(name string) (bool, error) + func (instance *Instance) HostAndOptionalPort() string + func (instance *Instance) Schema(name string) (*Schema, error) + func (instance *Instance) SchemaNames() ([]string, error) + func (instance *Instance) Schemas(onlyNames ...string) ([]*Schema, error) + func (instance *Instance) SchemasByName(onlyNames ...string) (map[string]*Schema, error) + func (instance *Instance) SetFlavor(flavor Flavor) error + func (instance *Instance) ShowCreateTable(schema, table string) (string, error) + func (instance *Instance) String() string + func (instance *Instance) TableHasRows(schema, table string) (bool, error) + func (instance *Instance) TableSize(schema, table string) (int64, error) + func (instance *Instance) Valid() (bool, error) + func (instance *Instance) Version() (int, int, int) + type IntegrationTestSuite interface + BeforeTest func(backend string) error + Setup func(backend string) error + Teardown func(backend string) error + type ModifyColumn struct + NewColumn *Column + OldColumn *Column + PositionAfter *Column + PositionFirst bool + Table *Table + func (mc ModifyColumn) Clause(mods StatementModifiers) string + func (mc ModifyColumn) Unsafe() bool + type ModifyPartitions struct + Add []*Partition + Drop []*Partition + ForDropTable bool + func (mp ModifyPartitions) Clause(mods StatementModifiers) string + func (mp ModifyPartitions) Unsafe() bool + type NextAutoIncMode int + const NextAutoIncAlways + const NextAutoIncIfAlready + const NextAutoIncIfIncreased + const NextAutoIncIgnore + type ObjectDiff interface + DiffType func() DiffType + Statement func(StatementModifiers) (string, error) + type ObjectKey struct + Name string + Type ObjectType + func (key ObjectKey) ObjectKey() ObjectKey + func (key ObjectKey) String() string + type ObjectKeyer interface + ObjectKey func() ObjectKey + type ObjectType string + const ObjectTypeDatabase + const ObjectTypeFunc + const ObjectTypeNil + const ObjectTypeProc + const ObjectTypeTable + func (ot ObjectType) Caps() string + type Partition struct + Comment string + DataDir string + Engine string + Name string + SubName string + Values string + func (p *Partition) Definition(flavor Flavor, method string) string + type PartitionBy struct + Partitioning *TablePartitioning + RePartition bool + func (pb PartitionBy) Clause(mods StatementModifiers) string + type PartitionListMode string + const PartitionListCount + const PartitionListDefault + const PartitionListExplicit + const PartitionListNone + type PartitioningMode int + const PartitioningKeep + const PartitioningPermissive + const PartitioningRemove + type RemovePartitioning struct + func (rp RemovePartitioning) Clause(mods StatementModifiers) string + type RenameColumn struct + NewName string + OldColumn *Column + func (rc RenameColumn) Clause(_ StatementModifiers) string + func (rc RenameColumn) Unsafe() bool + type Routine struct + Body string + Comment string + CreateStatement string + DatabaseCollation string + Definer string + Deterministic bool + Name string + ParamString string + ReturnDataType string + SQLDataAccess string + SQLMode string + SecurityType string + Type ObjectType + func (r *Routine) Def() string + func (r *Routine) DefinerClause() string + func (r *Routine) Definition(flavor Flavor) string + func (r *Routine) DropStatement() string + func (r *Routine) Equals(other *Routine) bool + func (r *Routine) ObjectKey() ObjectKey + type RoutineDiff struct + ForMetadata bool + From *Routine + To *Routine + func (rd *RoutineDiff) DiffType() DiffType + func (rd *RoutineDiff) ObjectKey() ObjectKey + func (rd *RoutineDiff) Statement(mods StatementModifiers) (string, error) + type Schema struct + CharSet string + Collation string + Name string + Routines []*Routine + Tables []*Table + func (s *Schema) AlterStatement(charSet, collation string) string + func (s *Schema) CreateStatement() string + func (s *Schema) Def() string + func (s *Schema) Diff(other *Schema) *SchemaDiff + func (s *Schema) DropStatement() string + func (s *Schema) FunctionsByName() map[string]*Routine + func (s *Schema) HasTable(name string) bool + func (s *Schema) ObjectKey() ObjectKey + func (s *Schema) Objects() map[ObjectKey]DefKeyer + func (s *Schema) ProceduresByName() map[string]*Routine + func (s *Schema) Table(name string) *Table + func (s *Schema) TablesByName() map[string]*Table + type SchemaCreationOptions struct + DefaultCharSet string + DefaultCollation string + SkipBinlog bool + type SchemaDiff struct + FromSchema *Schema + RoutineDiffs []*RoutineDiff + TableDiffs []*TableDiff + ToSchema *Schema + func NewSchemaDiff(from, to *Schema) *SchemaDiff + func (sd *SchemaDiff) DatabaseDiff() *DatabaseDiff + func (sd *SchemaDiff) FilteredTableDiffs(onlyTypes ...DiffType) []*TableDiff + func (sd *SchemaDiff) ObjectDiffs() []ObjectDiff + func (sd *SchemaDiff) String() string + type StatementModifiers struct + AlgorithmClause string + AllowUnsafe bool + CompareMetadata bool + Flavor Flavor + IgnoreTable *regexp.Regexp + LockClause string + NextAutoInc NextAutoIncMode + Partitioning PartitioningMode + SkipPreDropAlters bool + StrictCheckOrder bool + StrictForeignKeyNaming bool + StrictIndexOrder bool + VirtualColValidation bool + type Table struct + CharSet string + Checks []*Check + Collation string + CollationIsDefault bool + Columns []*Column + Comment string + CreateOptions string + CreateStatement string + Engine string + ForeignKeys []*ForeignKey + Name string + NextAutoIncrement uint64 + Partitioning *TablePartitioning + PrimaryKey *Index + SecondaryIndexes []*Index + UnsupportedDDL bool + func (t *Table) AlterStatement() string + func (t *Table) ClusteredIndexKey() *Index + func (t *Table) ColumnsByName() map[string]*Column + func (t *Table) Def() string + func (t *Table) Diff(to *Table) (clauses []TableAlterClause, supported bool) + func (t *Table) DropStatement() string + func (t *Table) GeneratedCreateStatement(flavor Flavor) string + func (t *Table) HasAutoIncrement() bool + func (t *Table) ObjectKey() ObjectKey + func (t *Table) RowFormatClause() string + func (t *Table) SecondaryIndexesByName() map[string]*Index + func (t *Table) UnpartitionedCreateStatement(flavor Flavor) string + type TableAlterClause interface + Clause func(StatementModifiers) string + type TableDiff struct + From *Table + To *Table + Type DiffType + func NewAlterTable(from, to *Table) *TableDiff + func NewCreateTable(table *Table) *TableDiff + func NewDropTable(table *Table) *TableDiff + func PreDropAlters(table *Table) []*TableDiff + func (td *TableDiff) Clauses(mods StatementModifiers) (string, error) + func (td *TableDiff) DiffType() DiffType + func (td *TableDiff) ObjectKey() ObjectKey + func (td *TableDiff) SplitAddForeignKeys() (*TableDiff, *TableDiff) + func (td *TableDiff) SplitConflicts() (result []*TableDiff) + func (td *TableDiff) Statement(mods StatementModifiers) (string, error) + type TablePartitioning struct + AlgoClause string + Expression string + ForcePartitionList PartitionListMode + Method string + Partitions []*Partition + SubExpression string + SubMethod string + func (tp *TablePartitioning) Definition(flavor Flavor) string + func (tp *TablePartitioning) Diff(other *TablePartitioning) (clauses []TableAlterClause, supported bool) + type Unsafer interface + Unsafe func() bool + type UnsupportedDiffError struct + ActualCreate string + ExpectedCreate string + ObjectKey ObjectKey + func (e *UnsupportedDiffError) Error() string + func (e *UnsupportedDiffError) ExtendedError() string + type Vendor int + const VendorMariaDB + const VendorMySQL + const VendorPercona + const VendorUnknown + func ParseVendor(versionComment string) Vendor + func (v Vendor) String() string