AllTables returns all tables in the database
()
| 392 | |
| 393 | // AllTables returns all tables in the database |
| 394 | func (d *Dalgorm) AllTables() ([]string, errors.Error) { |
| 395 | var tableSql string |
| 396 | if d.db.Dialector.Name() == "mysql" { |
| 397 | tableSql = "show tables" |
| 398 | } else { |
| 399 | tableSql = "select table_name from information_schema.tables where table_schema = 'public' and table_name not like '_devlake%'" |
| 400 | } |
| 401 | var tables []string |
| 402 | err := d.db.Raw(tableSql).Scan(&tables).Error |
| 403 | if err != nil { |
| 404 | return nil, d.convertGormError(err) |
| 405 | } |
| 406 | var filteredTables []string |
| 407 | for _, table := range tables { |
| 408 | if !strings.HasPrefix(table, "_devlake") { |
| 409 | filteredTables = append(filteredTables, table) |
| 410 | } |
| 411 | } |
| 412 | return filteredTables, nil |
| 413 | } |
| 414 | |
| 415 | // DropTables drop multiple tables by Model Pointer or Table Name |
| 416 | func (d *Dalgorm) DropTables(dst ...interface{}) errors.Error { |
nothing calls this directly
no test coverage detected