/
mapping.dm.go
62 lines (53 loc) · 1.55 KB
/
mapping.dm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package dialect
func NewMappingDM() (mapping *SqlMapping) {
mapping = &SqlMapping{
dialectType: TypeDM,
OwnerNamePackChar: "\"",
TableNamePackChar: "\"",
ColumnNamePackChar: "\"",
SqlValuePackChar: "'",
SqlValueEscapeChar: "'",
}
appendDmSql(mapping)
for _, one := range dmColumnTypeList {
mapping.AddColumnTypeInfo(one)
}
for _, one := range dmIndexTypeList {
mapping.AddIndexTypeInfo(one)
}
return
}
var (
dmIndexTypeList []*IndexTypeInfo
)
func appendDmIndexType(indexType *IndexTypeInfo) {
dmIndexTypeList = append(dmIndexTypeList, indexType)
}
func init() {
appendDmIndexType(&IndexTypeInfo{Name: "", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendDmIndexType(&IndexTypeInfo{Name: "INDEX", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendDmIndexType(&IndexTypeInfo{Name: "NORMAL", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendDmIndexType(&IndexTypeInfo{Name: "UNIQUE", Format: "UNIQUE",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
indexTypeFormat = "UNIQUE INDEX"
return
},
})
appendDmIndexType(&IndexTypeInfo{Name: "FULLTEXT", Format: "FULLTEXT", IsExtend: true,
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
return
},
})
appendDmIndexType(&IndexTypeInfo{Name: "SPATIAL", Format: "SPATIAL", IsExtend: true,
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
return
},
})
}