增加返回值

This commit is contained in:
白茶清欢 2021-10-25 21:01:01 +08:00
parent f8e2ab7f5b
commit d49f21dd30

View File

@ -26,15 +26,14 @@ const (
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 4:49 下午 2021/10/25 // Date : 4:49 下午 2021/10/25
func ParseCreateTableSql(sql string) { func ParseCreateTableSql(sql string) (string, error) {
var ( var (
stmt sqlparser.Statement stmt sqlparser.Statement
err error err error
) )
sql = strings.ReplaceAll(sql, " ", "") sql = strings.ReplaceAll(sql, " ", "")
if stmt, err = sqlparser.ParseStrictDDL(sql); nil != err { if stmt, err = sqlparser.ParseStrictDDL(sql); nil != err {
fmt.Println(err.Error(), string(sql[786:])) return "", err
return
} }
r := stmt.(*sqlparser.DDL) r := stmt.(*sqlparser.DDL)
@ -59,5 +58,5 @@ func ParseCreateTableSql(sql string) {
} }
fmt.Println(val) fmt.Println(val)
} }
// fmt.Println(r.TableSpec) return "", nil
} }