reactor sql generation

This commit is contained in:
anqiansong
2020-08-12 09:19:37 +08:00
parent 40895ba8d9
commit f226ffb57c
45 changed files with 892 additions and 1045 deletions

View File

@@ -0,0 +1,23 @@
package gen
import (
"regexp"
)
func (g *defaultGenerator) split() []string {
reg := regexp.MustCompile(createTableFlag)
index := reg.FindAllStringIndex(g.source, -1)
list := make([]string, 0)
source := g.source
for i := len(index) - 1; i >= 0; i-- {
subIndex := index[i]
if len(subIndex) == 0 {
continue
}
start := subIndex[0]
ddl := source[start:]
list = append(list, ddl)
source = source[:start]
}
return list
}