Skip to content
Snippets Groups Projects
Commit b72aefdc authored by Pawan Rawal's avatar Pawan Rawal
Browse files

modifying Value method

parent 5a8a84a8
No related branches found
No related tags found
No related merge requests found
......@@ -91,19 +91,18 @@ func (e *Entity) HasValue(property string) bool {
// This method returns the value corresponding to a property if one exists.
func (e *Entity) Value(property string) []byte {
for _, predChild := range e.gr.Children {
if len(predChild.Children) > 0 || predChild.Attribute != property {
continue
}
idx := indexOf(e.uid, predChild.Query.Uids)
if idx == -1 {
glog.WithFields(logrus.Fields{
"uid": e.uid,
"attribute": e.Attribute,
"childAttribute": predChild.Attribute,
}).Fatal("Attribute with uid not found in child Query uids")
return []byte{}
if predChild.Attribute == property {
idx := indexOf(e.uid, predChild.Query.Uids)
if idx == -1 {
glog.WithFields(logrus.Fields{
"uid": e.uid,
"attribute": e.Attribute,
"childAttribute": predChild.Attribute,
}).Fatal("Attribute with uid not found in child Query uids")
return []byte{}
}
return predChild.Result.Values[idx]
}
return predChild.Result.Values[idx]
}
return []byte{}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment