(name string)
| 179 | } |
| 180 | |
| 181 | func (t *TableMap) DropIndex(name string) error { |
| 182 | |
| 183 | var err error |
| 184 | dialect := reflect.TypeOf(t.dbmap.Dialect) |
| 185 | for _, idx := range t.indexes { |
| 186 | if idx.IndexName == name { |
| 187 | s := bytes.Buffer{} |
| 188 | s.WriteString(fmt.Sprintf("DROP INDEX %s", idx.IndexName)) |
| 189 | |
| 190 | if dname := dialect.Name(); dname == "MySQLDialect" { |
| 191 | s.WriteString(fmt.Sprintf(" %s %s", t.dbmap.Dialect.DropIndexSuffix(), t.TableName)) |
| 192 | } |
| 193 | s.WriteString(";") |
| 194 | _, e := t.dbmap.Exec(s.String()) |
| 195 | if e != nil { |
| 196 | err = e |
| 197 | } |
| 198 | break |
| 199 | } |
| 200 | } |
| 201 | t.ResetSql() |
| 202 | return err |
| 203 | } |
| 204 | |
| 205 | // AddTable registers the given interface type with gorp. The table name |
| 206 | // will be given the name of the TypeOf(i). You must call this function, |
nothing calls this directly
no test coverage detected