mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-26 11:28:46 +08:00
24fb29a356
* change column to read from information_schema * reactor generate mode from datasource * reactor generate mode from datasource * add primary key check logic * resolve rebase conflicts * add naming style * add filename test case * resolve rebase conflicts * reactor test * add test case * change shell script to makefile * update rpc new * update gen_test.go * format code * format code * update test * generates alias
23 lines
433 B
Go
23 lines
433 B
Go
package gen
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
func (g *defaultGenerator) split(source string) []string {
|
|
reg := regexp.MustCompile(createTableFlag)
|
|
index := reg.FindAllStringIndex(source, -1)
|
|
list := make([]string, 0)
|
|
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
|
|
}
|