github.com/team-ide/go-dialect@v1.9.20/dialect/mapping.dm.go (about)

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