修复数据非ddl sql, panixc问题
This commit is contained in:
parent
ab74a47a78
commit
1b603bfd93
@ -8,6 +8,7 @@
|
||||
package sql2go
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/gopkg/util"
|
||||
@ -54,7 +55,10 @@ func ParseCreateTableSql(sql string) (string, *BasicTableInfo, error) {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
r := stmt.(*sqlparser.DDL)
|
||||
r, ok := stmt.(*sqlparser.DDL)
|
||||
if !ok {
|
||||
return "", nil, errors.New("input sql is not ddl")
|
||||
}
|
||||
basic.TableName = sqlparser.String(r.NewName)
|
||||
basic.ModelStruct = util.SnakeCaseToCamel(basic.TableName)
|
||||
structResult := "type " + basic.ModelStruct + " struct { \n"
|
||||
|
Loading…
Reference in New Issue
Block a user