mirror of
https://github.com/abice/go-enum.git
synced 2026-10-28 16:46:59 +08:00
* Update to support go 1.18 stuff * add new tests * change release to use 1.18 * fix older versions * drop support of 1.13 * up the code coverage
23 lines
391 B
Go
23 lines
391 B
Go
//go:build go1.18
|
|
// +build go1.18
|
|
|
|
package generator
|
|
|
|
// SumIntsOrFloats sums the values of map m. It supports both int64 and float64
|
|
// as types for map values.
|
|
func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V {
|
|
var s V
|
|
for _, v := range m {
|
|
s += v
|
|
}
|
|
return s
|
|
}
|
|
|
|
// ChangeType is a type of change detected.
|
|
/* ENUM(
|
|
Create
|
|
Update
|
|
Delete
|
|
) */
|
|
type ChangeType int
|