mirror of
https://github.com/opbnq-q/nto-cli.git
synced 2025-12-06 16:30:33 +07:00
feat: hide implement models from select
This commit is contained in:
11
utils/get_not_implemented_structs.go
Normal file
11
utils/get_not_implemented_structs.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package utils
|
||||
|
||||
func GetNotImplementedStructs(modelsFilePath string) []string {
|
||||
var models []string
|
||||
for _, model := range GetStructsList(modelsFilePath) {
|
||||
if !IsEntityImplemented(model) {
|
||||
models = append(models, model)
|
||||
}
|
||||
}
|
||||
return models
|
||||
}
|
||||
@@ -10,9 +10,7 @@ import (
|
||||
|
||||
func GetStructFields(file *os.File, structName string) []entities.Field {
|
||||
bracketsCount := 1
|
||||
|
||||
structFound := false
|
||||
|
||||
var structFound bool
|
||||
var structFields []entities.Field
|
||||
|
||||
scanner := bufio.NewScanner(file)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetStructList(filePath string) []string {
|
||||
file, err := os.Open(filePath)
|
||||
func GetStructsList(modelsFilePath string) []string {
|
||||
file, err := os.Open(modelsFilePath)
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open a file: %s", err)
|
||||
|
||||
16
utils/is_implemented.go
Normal file
16
utils/is_implemented.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func IsEntityImplemented(entityName string) bool {
|
||||
entityDirectory := filepath.Join(FindFrontendPath(), strings.ToLower(entityName))
|
||||
if _, err := os.Stat(entityDirectory); os.IsNotExist(err) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user