AggByColumnName returns Agg results for given column name, optionally including :Name agg name appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg). Returns nil if not found. See also Try version for error message.
(name string)
| 349 | // appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg). |
| 350 | // Returns nil if not found. See also Try version for error message. |
| 351 | func (spl *Splits) AggByColumnName(name string) *SplitAgg { |
| 352 | dt := spl.Table() |
| 353 | if dt == nil { |
| 354 | return nil |
| 355 | } |
| 356 | nmsp := strings.Split(name, ":") |
| 357 | colIndex := dt.ColumnIndex(nmsp[0]) |
| 358 | if colIndex == -1 { |
| 359 | return nil |
| 360 | } |
| 361 | for _, ag := range spl.Aggs { |
| 362 | if ag.ColumnIndex != colIndex { |
| 363 | continue |
| 364 | } |
| 365 | if len(nmsp) == 2 && nmsp[1] != ag.Name { |
| 366 | continue |
| 367 | } |
| 368 | return ag |
| 369 | } |
| 370 | return nil |
| 371 | } |
| 372 | |
| 373 | // AggByColumnNameTry returns Agg results for given column name, optionally including :Name agg name |
| 374 | // appended, where Name is the name given to the Agg result (e.g., Mean for a standard Mean agg). |
no test coverage detected