fix: paths, feat: many models, selection

This commit is contained in:
2025-03-06 23:51:54 +07:00
parent 63360da52e
commit 77ff582d59
8 changed files with 192 additions and 32 deletions

32
utils/get_structs_list.go Normal file
View File

@@ -0,0 +1,32 @@
package utils
import (
"bufio"
"os"
"strings"
)
func GetStructList(filePath string) ([]string) {
file, err := os.Open(filePath)
if err != nil {
panic(err)
}
defer file.Close()
var structNames []string
s := bufio.NewScanner(file)
for s.Scan() {
line := s.Text()
if strings.Contains(line, "type ") && strings.Contains(line, " struct") {
start := strings.Index(line, "type ") + 5
end := strings.Index(line, " struct")
name := strings.TrimSpace(line[start:end])
if name != "" {
structNames = append(structNames, name)
}
}
}
if err := s.Err(); err != nil {
panic(err)
}
return structNames
}