Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Allow column aliasing #7

@tannerlinsley

Description

@tannerlinsley

If an aggregation is the only nested item in an alias, then the resulting data should be flatten into that alias, eg.

.query({
  groupBy: 'type',
  select: {
    myColumn: {
      $sum: 'total'
    }
  }
})

should result in:

[{
  key: 'type1',
  value: {
    myColumn: 30
  }
}, {
  key: 'type2',
  value: {
    myColumn: 15
  }
}, {
  key: 'type3',
  value: {
    myColumn: 24
  }
}, {
  key: 'type4',
  value: {
    myColumn: 12
  }
}]

this should also work with the string syntax. eg.

.query({
  groupBy: 'type',
  select: {
    myColumn: '$sum(total)'
  }
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions