americanas-tech / restQL-golang

Microservice query language and platform
http://restql.b2w.io/
MIT License
17 stars 8 forks source link

Merge objects when aggregating over a field that already exist #46

Closed caiorcferreira closed 3 years ago

caiorcferreira commented 3 years ago

This PR improves the aggregation feature. Instead of replacing the value if the field already exists, it merge both if possible. For example:

from x Returns

{
  "values": [
    { "id": 1 },
    { "id": 2 }
  ]
}

from y Returns

[
  { "name": "bla" }, 
  { "name": "ble" }
]

Then

from x

from y in x.values

Returns

[
  { "id": 1, "name": "bla" },
  { "id": 2, "name": "ble" }
]