github.com/team-ide/go-dialect@v1.9.20/dialect/mapping.sqlite.go (about) 1 package dialect 2 3 func NewMappingSqlite() (mapping *SqlMapping) { 4 mapping = &SqlMapping{ 5 dialectType: TypeSqlite, 6 7 OwnerNamePackChar: "\"", 8 TableNamePackChar: "\"", 9 ColumnNamePackChar: "\"", 10 SqlValuePackChar: "'", 11 SqlValueEscapeChar: "'", 12 } 13 14 appendSqliteSql(mapping) 15 16 for _, one := range sqliteColumnTypeList { 17 mapping.AddColumnTypeInfo(one) 18 } 19 20 for _, one := range sqliteIndexTypeList { 21 mapping.AddIndexTypeInfo(one) 22 } 23 24 return 25 } 26 27 var ( 28 sqliteIndexTypeList []*IndexTypeInfo 29 ) 30 31 func appendSqliteIndexType(indexType *IndexTypeInfo) { 32 sqliteIndexTypeList = append(sqliteIndexTypeList, indexType) 33 } 34 35 func init() { 36 37 appendSqliteIndexType(&IndexTypeInfo{Name: "", Format: "INDEX"}) 38 appendSqliteIndexType(&IndexTypeInfo{Name: "INDEX", Format: "INDEX"}) 39 appendSqliteIndexType(&IndexTypeInfo{Name: "NORMAL", Format: "INDEX", IsExtend: true}) 40 appendSqliteIndexType(&IndexTypeInfo{Name: "UNIQUE", Format: "UNIQUE", 41 IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) { 42 indexTypeFormat = "UNIQUE INDEX" 43 return 44 }, 45 }) 46 appendSqliteIndexType(&IndexTypeInfo{Name: "FULLTEXT", Format: "FULLTEXT", IsExtend: true, 47 IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) { 48 return 49 }, 50 }) 51 appendSqliteIndexType(&IndexTypeInfo{Name: "SPATIAL", Format: "SPATIAL", IsExtend: true, 52 IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) { 53 return 54 }, 55 }) 56 }