feature model fix (#296)

* add raw stirng quote for sql field

* remove unused code
This commit is contained in:
anqiansong
2020-12-21 09:43:32 +08:00
committed by GitHub
parent 097f6886f2
commit a3b525b50d
21 changed files with 1127 additions and 59 deletions

View File

@@ -1,34 +0,0 @@
package model
import (
"github.com/tal-tech/go-zero/core/stores/sqlx"
)
type (
DDLModel struct {
conn sqlx.SqlConn
}
DDL struct {
Table string `db:"Table"`
DDL string `db:"Create Table"`
}
)
func NewDDLModel(conn sqlx.SqlConn) *DDLModel {
return &DDLModel{conn: conn}
}
func (m *DDLModel) ShowDDL(table ...string) ([]string, error) {
var ddl []string
for _, t := range table {
query := `show create table ` + t
var resp DDL
err := m.conn.QueryRow(&resp, query)
if err != nil {
return nil, err
}
ddl = append(ddl, resp.DDL)
}
return ddl, nil
}