Commit 0e7714a3 authored by Ajit Jagtap's avatar Ajit Jagtap
Browse files

Merge branch 'Roshanp-BugFixes' into 'devbranch'

Roshanp bug fixes

See merge request !36
parents d48c0649 1a4397a0
2 merge requests!37Devbranch to Master,!36Roshanp bug fixes
Showing with 8 additions and 4 deletions
......@@ -175,7 +175,10 @@ func (mg *MongoDAO) GetData(selector map[string]interface{}) (*gjson.Result, err
collection := session.DB(db.Database).C(mg.collectionName)
var result []interface{}
collection.Find(selector).All(&result)
ba, _ := json.Marshal(result)
ba, marshalError := json.Marshal(result)
if errormdl.CheckErr2(marshalError) != nil {
return nil, errormdl.CheckErr2(marshalError)
}
rs := gjson.ParseBytes(ba)
return &rs, nil
}
......
......@@ -130,14 +130,15 @@ func (m *Runable) Run(data []byte) (interface{}, error) {
func (m *Runable) runMongoService(data []byte) (interface{}, error) {
rs := gjson.ParseBytes(data)
tmp := m.MongoQuery.Query
for i, arg := range m.MongoQuery.Args {
result := rs.Get(arg).String()
argNotation := "~" + strconv.Itoa(i+1)
m.MongoQuery.Query = strings.Replace(m.MongoQuery.Query, argNotation, result, 1)
tmp = strings.Replace(tmp, argNotation, result, 1)
}
var v map[string]interface{}
unmarshalError := json.Unmarshal([]byte(m.MongoQuery.Query), &v)
unmarshalError := json.Unmarshal([]byte(tmp), &v)
if errormdl.CheckErr(unmarshalError) != nil {
loggermdl.LogError(unmarshalError)
return nil, errormdl.CheckErr(unmarshalError)
......
......@@ -306,7 +306,7 @@ func (sb *ServiceBuilder) executeErrorFunction(fn func() (map[string]interface{}
loggermdl.LogError(err)
return nil, errormdl.CheckErr(err)
}
return nil, nil
return sb.businessLogicHolder.GetFinalData(), nil
}
// finalOutput return Final output
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment