修改SQL对比算法

This commit is contained in:
刘祥超
2020-11-16 23:30:47 +08:00
parent 1c703dd013
commit e76ba5cc6b
21 changed files with 588 additions and 1512 deletions

View File

@@ -0,0 +1,38 @@
package setup
type SQLTable struct {
Name string `json:"name"`
Engine string `json:"engine"`
Charset string `json:"charset"`
Definition string `json:"definition"`
Fields []*SQLField `json:"fields"`
Indexes []*SQLIndex `json:"indexes"`
Records []*SQLRecord `json:"records"`
}
func (this *SQLTable) FindField(fieldName string) *SQLField {
for _, field := range this.Fields {
if field.Name == fieldName {
return field
}
}
return nil
}
func (this *SQLTable) FindIndex(indexName string) *SQLIndex {
for _, index := range this.Indexes {
if index.Name == indexName {
return index
}
}
return nil
}
func (this *SQLTable) FindRecord(id int64) *SQLRecord {
for _, record := range this.Records {
if record.Id == id {
return record
}
}
return nil
}