Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ByField = generic.DefineFunc("MaxByField(vals T) E"). Param("T", "array type"). Param("E", "array element type", func(argMap generic.ArgMap) interface{} { return argMap["T"].(reflect.Type).Elem() }). Param("F", "the field to compare"). ImportFunc(compare.ByField). Source(` {{ $compare := expand "CompareByField" "T" .E "F" .F }} currentMax := vals[0] for i := 1; i < len(vals); i++ { if {{$compare}}(vals[i], currentMax) > 0 { currentMax = vals[i] } } return currentMax`)
View Source
var ByFieldForPlz = generic.DefineFunc("MaxByFieldForPlz(vals []interface{}) interface{}"). Param("T", "array element type"). Param("F", "the field to compare"). ImportFunc(compare.ByField). Source(` {{ $compare := expand "CompareByField" "T" .T "F" .F }} currentMax := vals[0].({{.T|name}}) for i := 1; i < len(vals); i++ { typedVal := vals[i].({{.T|name}}) if {{$compare}}(typedVal, currentMax) > 0 { currentMax = typedVal } } return currentMax`)
View Source
var ByItself = generic.DefineFunc("MaxByItself(vals T) E"). Param("T", "array type"). Param("E", "array element type", func(argMap generic.ArgMap) interface{} { return argMap["T"].(reflect.Type).Elem() }). ImportFunc(compare.ByItself). Source(` {{ $compare := expand "CompareByItself" "T" .E }} currentMax := vals[0] for i := 1; i < len(vals); i++ { if {{$compare}}(vals[i], currentMax) > 0 { currentMax = vals[i] } } return currentMax`)
View Source
var ByItselfForPlz = generic.DefineFunc("MaxByItselfForPlz(vals []interface{}) interface{}"). Param("T", "array element type"). ImportFunc(compare.ByItself). Source(` {{ $compare := expand "CompareByItself" "T" .T }} currentMax := vals[0].({{.T|name}}) for i := 1; i < len(vals); i++ { typedVal := vals[i].({{.T|name}}) if {{$compare}}(typedVal, currentMax) > 0 { currentMax = typedVal } } return currentMax`)
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.