This commit is contained in:
Daniel 2025-07-27 19:34:17 +08:00
parent ff539bab03
commit d0662b5fde
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 19 additions and 13 deletions

View file

@ -220,6 +220,21 @@ func (view *View) GetGroup(groupID string) *View {
return nil
}
// GetGroupKey 获取分组视图的分组字段。
func (view *View) GetGroupKey(attrView *AttributeView) (ret *Key) {
if nil == view.Group || "" == view.Group.Field {
return
}
for _, kv := range attrView.KeyValues {
if kv.Key.ID == view.Group.Field {
ret = kv.Key
return
}
}
return
}
// GroupCalc 描述了分组计算规则和结果的结构。
type GroupCalc struct {
Field string `json:"field"` // 字段 ID