Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
longyue0521 committed Jun 16, 2024
1 parent a0ba2eb commit bcffa07
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/merger/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"strings"
"time"

"github.com/ecodeclub/ekit/slice"
"github.com/ecodeclub/eorm/internal/merger/internal/errs"
"github.com/ecodeclub/eorm/internal/rows"
)
Expand Down Expand Up @@ -67,6 +68,11 @@ func (c ColumnInfo) SelectName() string {
func (c ColumnInfo) Validate() bool {
// ColumnInfo.Name中不能包含括号,也就是聚合函数, name = `id`, 而不是name = count(`id`)
// 聚合函数需要写在aggregateFunc字段中
aggregateFuncs := []string{"MAX", "MIN", "AVG", "SUM", "COUNT"}
if c.AggregateFunc != "" &&
!slice.ContainsFunc(aggregateFuncs, func(src string) bool { return strings.EqualFold(src, c.AggregateFunc) }) {
return false
}
return !strings.Contains(c.Name, "(")
}

Expand Down

0 comments on commit bcffa07

Please sign in to comment.