util

package
v0.0.0-...-1b63e00 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DateFormat = "02.01.2006"

DateFormat is the date format we are using

View Source
const Imperial = "imperial"

Imperial depicts the identifier for the imperial unit system

View Source
const Metric = "metric"

Metric depicts the identifier for the metric unit system

Variables

This section is empty.

Functions

func AskConfirmation

func AskConfirmation(s string, r io.Reader) (bool, error)

AskConfirmation asks the user for confirmation on a given question and returns the user's answer

func CalculateAgeInYears

func CalculateAgeInYears(birthday time.Time) int

CalculateAgeInYears calculates the age in years given a date by comparing the year, month and day of now and the given date

func CalculateHarrisBenedict

func CalculateHarrisBenedict(age, height, weight, activity float64, gender string) (float64, float64)

CalculateHarrisBenedict calculates Harris-Benedict (https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation) for calculating the basic metabolic rate

func GetBeginningOfWeek

func GetBeginningOfWeek(date time.Time) time.Time

GetBeginningOfWeek calculates the first day of the week (Monday) given a date

func HeightUnit

func HeightUnit(unitSystem string, value float64) string

HeightUnit returns the height unit for the given unit system

func ToCm

func ToCm(height float64) float64

ToCm converts inches to cm

func ToInches

func ToInches(height float64) float64

ToInches converts cm to inches

func ToKg

func ToKg(weight float64) float64

ToKg converts pounds to kg

func ToPounds

func ToPounds(weight float64) float64

ToPounds converts kg to pounds

func WeightUnit

func WeightUnit(unitSystem string, value float64) string

WeightUnit returns the weight unit for the given unit system

Types

This section is empty.

Jump to

Keyboard shortcuts

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