feat: add method GetIndexes
This commit is contained in:
parent
8d45714628
commit
076e9777ee
@ -50,6 +50,14 @@ type ColumnType interface {
|
||||
Comment() (value string, ok bool)
|
||||
DefaultValue() (value string, ok bool)
|
||||
}
|
||||
type Index interface {
|
||||
Table() string
|
||||
Name() string
|
||||
Columns() []string
|
||||
PrimaryKey() (isPrimaryKey bool, ok bool)
|
||||
Unique() (unique bool, ok bool)
|
||||
Option() string
|
||||
}
|
||||
|
||||
// Migrator migrator interface
|
||||
type Migrator interface {
|
||||
@ -90,4 +98,5 @@ type Migrator interface {
|
||||
DropIndex(dst interface{}, name string) error
|
||||
HasIndex(dst interface{}, name string) bool
|
||||
RenameIndex(dst interface{}, oldName, newName string) error
|
||||
GetIndexes(dst interface{}) ([]Index, error)
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package migrator
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@ -854,3 +855,8 @@ func (m Migrator) CurrentTable(stmt *gorm.Statement) interface{} {
|
||||
}
|
||||
return clause.Table{Name: stmt.Table}
|
||||
}
|
||||
|
||||
// GetIndexes return Indexes []gorm.Index and execErr error
|
||||
func (m Migrator) GetIndexes(dst interface{}) ([]gorm.Index, error) {
|
||||
return nil, errors.New("not support")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user