github.com/team-ide/go-dialect@v1.9.20/dialect/mapping.mysql.go (about) 1 package dialect 2 3 func NewMappingMysql() (mapping *SqlMapping) { 4 mapping = &SqlMapping{ 5 dialectType: TypeMysql, 6 7 OwnerNamePackChar: "`", 8 TableNamePackChar: "`", 9 ColumnNamePackChar: "`", 10 SqlValuePackChar: "'", 11 SqlValueEscapeChar: "\\", 12 } 13 14 appendMysqlSql(mapping) 15 16 for _, one := range mysqlColumnTypeList { 17 mapping.AddColumnTypeInfo(one) 18 } 19 20 for _, one := range mysqlIndexTypeList { 21 mapping.AddIndexTypeInfo(one) 22 } 23 24 return 25 } 26 27 var ( 28 mysqlIndexTypeList []*IndexTypeInfo 29 ) 30 31 func appendMysqlIndexType(indexType *IndexTypeInfo) { 32 mysqlIndexTypeList = append(mysqlIndexTypeList, indexType) 33 } 34 35 func init() { 36 appendMysqlIndexType(&IndexTypeInfo{Name: "", Format: "INDEX", 37 NotSupportDataTypes: []string{"TEXT"}, 38 }) 39 appendMysqlIndexType(&IndexTypeInfo{Name: "INDEX", Format: "INDEX", 40 NotSupportDataTypes: []string{"TEXT"}, 41 }) 42 appendMysqlIndexType(&IndexTypeInfo{Name: "NORMAL", Format: "INDEX"}) 43 appendMysqlIndexType(&IndexTypeInfo{Name: "UNIQUE", Format: "UNIQUE", 44 NotSupportDataTypes: []string{"TEXT"}, 45 }) 46 appendMysqlIndexType(&IndexTypeInfo{Name: "FULLTEXT", Format: "FULLTEXT", OnlySupportDataTypes: []string{"CHAR", "VARCHAR", "TEXT"}}) 47 appendMysqlIndexType(&IndexTypeInfo{Name: "SPATIAL", Format: "SPATIAL", OnlySupportDataTypes: []string{"GEOMETRY", "POINT", "LINESTRING", "POLYGON"}}) 48 }