Kick name malformed
This commit is contained in:
@@ -3,6 +3,7 @@ package dbs
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -239,6 +240,9 @@ func jsonToBsonPaths(t reflect.Type, prefix string) map[string]string {
|
|||||||
}
|
}
|
||||||
if ft.Kind() == reflect.Struct {
|
if ft.Kind() == reflect.Struct {
|
||||||
embedPrefix := strings.ToLower(ft.Name())
|
embedPrefix := strings.ToLower(ft.Name())
|
||||||
|
re := regexp.MustCompile(`\[[^\]]*\]`)
|
||||||
|
embedPrefix = re.ReplaceAllString(embedPrefix, "")
|
||||||
|
embedPrefix = strings.ReplaceAll(embedPrefix, "*", "")
|
||||||
if prefix != "" {
|
if prefix != "" {
|
||||||
embedPrefix = prefix + "." + embedPrefix
|
embedPrefix = prefix + "." + embedPrefix
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user