@@ -25,6 +25,7 @@ type InnerSQL interface {
25
25
const (
26
26
InnerSelectTable_ = "@selectTable_"
27
27
InnerSelectTableLimit_ = "@selectTableLImit100_"
28
+ InnerDescribeTable_ = "@describeTable_"
28
29
InnerShowDatabases = "@showDatabases"
29
30
InnerShowTables = "@showTables"
30
31
InnerCurrentDB = "@currentDB"
@@ -39,14 +40,15 @@ func GetInnerSQL(dialect string) InnerSQL {
39
40
}
40
41
}
41
42
42
- type mysqlDialect struct {
43
- }
43
+ type mysqlDialect struct {}
44
44
45
45
func (m * mysqlDialect ) ToNativeSQL (query string ) (sql string ) {
46
46
if strings .HasPrefix (query , InnerSelectTable_ ) {
47
47
sql = "SELECT * FROM " + strings .ReplaceAll (query , InnerSelectTable_ , "" )
48
48
} else if strings .HasPrefix (query , InnerSelectTableLimit_ ) {
49
49
sql = "SELECT * FROM " + strings .ReplaceAll (query , InnerSelectTableLimit_ , "" ) + " LIMIT 100"
50
+ } else if strings .HasPrefix (query , InnerDescribeTable_ ) {
51
+ sql = "desc " + strings .ReplaceAll (query , InnerDescribeTable_ , "" )
50
52
} else if query == InnerShowDatabases {
51
53
sql = "SHOW DATABASES"
52
54
} else if query == InnerShowTables {
@@ -59,8 +61,7 @@ func (m *mysqlDialect) ToNativeSQL(query string) (sql string) {
59
61
return
60
62
}
61
63
62
- type postgresDialect struct {
63
- }
64
+ type postgresDialect struct {}
64
65
65
66
func (p * postgresDialect ) ToNativeSQL (query string ) (sql string ) {
66
67
if strings .HasPrefix (query , InnerSelectTable_ ) {
0 commit comments