generics

package
v0.0.0-...-517d9f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package generics Time : 2022/8/11 09:29 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SumFloats

func SumFloats(m map[string]float64) float64

SumFloats adds together the values of m.

func SumInts

func SumInts(m map[string]int64) int64

SumInts adds together the values of m.

func SumIntsOrFloats

func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V

SumIntsOrFloats sums the values of map m. It supports both int64 and float64 as types for map values.

func SumNumbers

func SumNumbers[K comparable, V Number](m map[K]V) V

SumNumbers sums the values of map m. Its supports both integers and floats as map values.

Types

type Number

type Number interface {
	int64 | float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL