Merge pull request #650 from austin362667/fix/persistence

Fix: Persistence Reflect IsZero
This commit is contained in:
Yo-An Lin 2022-06-02 02:32:36 +08:00 committed by GitHub
commit 47098b08dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,6 +92,10 @@ func iterateFieldsByTag(obj interface{}, tagName string, cb StructFieldIterator)
sv := reflect.ValueOf(obj)
st := reflect.TypeOf(obj)
if sv.IsZero() {
return nil
}
if st.Kind() != reflect.Ptr {
return fmt.Errorf("f needs to be a pointer of a struct, %s given", st)
}