Documentation ¶
Index ¶
- Constants
- func CheckSchemaDiff(cfg *Config)
- type AlterIgnoreTable
- type Config
- func (cfg *Config) ChechMatchTables(name string) bool
- func (cfg *Config) Check()
- func (cfg *Config) IsIgnoreField(table string, name string) bool
- func (cfg *Config) IsIgnoreForeignKey(table string, name string) bool
- func (cfg *Config) IsIgnoreIndex(table string, name string) bool
- func (cfg *Config) SendMailFail(errStr string)
- func (cfg *Config) String() string
- type DbIndex
- type EmailStruct
- type MyDb
- type MySchema
- type SchemaDiff
- type SchemaSync
- type TableAlterData
Constants ¶
View Source
const AppURL = "https://github.com/hidu/mysql-schema-sync/"
AppURL site
View Source
const Version = "0.3"
Version version
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlterIgnoreTable ¶
type AlterIgnoreTable struct { Column []string `json:"column"` Index []string `json:"index"` ForeignKey []string `json:"foreign"` //外键 }
AlterIgnoreTable table's ignore info
type Config ¶
type Config struct { SourceDSN string `json:"source"` DestDSN string `json:"dest"` AlterIgnore map[string]*AlterIgnoreTable `json:"alter_ignore"` Tables []string `json:"tables"` Email *EmailStruct `json:"email"` ConfigPath string Sync bool Drop bool }
Config config struct
func (*Config) ChechMatchTables ¶
ChechMatchTables check table is match
func (*Config) IsIgnoreField ¶
IsIgnoreField isIgnore
func (*Config) IsIgnoreForeignKey ¶
IsIgnoreForeignKey 检查外键是否忽略掉
func (*Config) IsIgnoreIndex ¶
IsIgnoreIndex is index ignore
func (*Config) SendMailFail ¶
SendMailFail send fail mail
type EmailStruct ¶
type EmailStruct struct { SendMailAble bool `json:"send_mail"` SMTPHost string `json:"smtp_host"` From string `json:"from"` Password string `json:"password"` To string `json:"to"` }
EmailStruct email conf info
func (*EmailStruct) SendMail ¶
func (m *EmailStruct) SendMail(title string, body string)
SendMail send mail
type MySchema ¶
type MySchema struct { SchemaRaw string Fields map[string]string IndexAll map[string]*DbIndex ForeignAll map[string]*DbIndex }
MySchema table schema
func (*MySchema) GetFieldNames ¶
GetFieldNames table names
func (*MySchema) RelationTables ¶
type SchemaDiff ¶
func (*SchemaDiff) RelationTables ¶
func (sdiff *SchemaDiff) RelationTables() []string
type SchemaSync ¶
SchemaSync 配置文件
func (*SchemaSync) GetNewTableNames ¶
func (sc *SchemaSync) GetNewTableNames() []string
GetNewTableNames 获取所有新增加的表名
func (*SchemaSync) SyncSQL4Dest ¶
func (sc *SchemaSync) SyncSQL4Dest(sqlStr string, sqls []string) error
SyncSQL4Dest sync schema change
type TableAlterData ¶
type TableAlterData struct { Table string Type alterType SQL string SchemaDiff *SchemaDiff }
TableAlterData 表的变更情况
func (*TableAlterData) String ¶
func (ta *TableAlterData) String() string
Click to show internal directories.
Click to hide internal directories.