field use another cacheStore

This commit is contained in:
wener 2021-01-19 15:06:36 +08:00
parent 6e256da84c
commit 182028be1a

View File

@ -7,6 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
"sync"
"time" "time"
"github.com/jinzhu/now" "github.com/jinzhu/now"
@ -333,7 +334,8 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field {
field.Updatable = false field.Updatable = false
field.Readable = false field.Readable = false
cacheStore := schema.cacheStore cacheStore := &sync.Map{}
cacheStore.Store(schema.ModelType, schema)
if field.EmbeddedSchema, err = getOrParse(fieldValue.Interface(), cacheStore, embeddedNamer{Table: schema.Table, Namer: schema.namer}); err != nil { if field.EmbeddedSchema, err = getOrParse(fieldValue.Interface(), cacheStore, embeddedNamer{Table: schema.Table, Namer: schema.namer}); err != nil {
schema.err = err schema.err = err
} }