Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,17 @@ func (tp *nativeTypeProvider) FindStructFieldType(typeName, fieldName string) (*
if !ok {
return nil, false
}
refFieldName := refField.Name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow how the input field name differs from the refField.Name value in this case. Could you add a test to illustrate the change in behavior?

return &types.FieldType{
Type: celType,
IsSet: func(obj any) bool {
refVal := reflect.Indirect(reflect.ValueOf(obj))
refField := refVal.FieldByName(fieldName)
refField := refVal.FieldByName(refFieldName)
return !refField.IsZero()
},
GetFrom: func(obj any) (any, error) {
refVal := reflect.Indirect(reflect.ValueOf(obj))
refField := refVal.FieldByName(fieldName)
refField := refVal.FieldByName(refFieldName)
return getFieldValue(tp, refField), nil
},
}, true
Expand Down