stats

package
v0.0.0-...-b080cc2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Avg

func Avg(payments []types.Payment) types.Money
Example
payments := []types.Payment{
	{
		ID:       1,
		Amount:   10_00,
		Category: "qr",
	},
	{
		ID:       2,
		Amount:   150_00,
		Category: "qr",
	},
	{
		ID:       3,
		Amount:   110_00,
		Category: "shop",
	},
}

fmt.Println(Avg(payments))
Output:

9000

func TotalInCategory

func TotalInCategory(payments []types.Payment, category types.Category) types.Money
Example
payments := []types.Payment{
	{
		ID:       1,
		Amount:   10_00,
		Category: "qr",
	},
	{
		ID:       2,
		Amount:   150_00,
		Category: "qr",
	},
	{
		ID:       3,
		Amount:   110_00,
		Category: "shop",
	},
}

fmt.Println(TotalInCategory(payments, "qr"))
Output:

16000

Types

This section is empty.

Jump to

Keyboard shortcuts

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