tools

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateAge

func CalculateAge(age float64, unit string) float64

CalculateAge to year

func CalculateAlcoholConsumption

func CalculateAlcoholConsumption(value float64, frequency string) float64

CalculateAlcoholConsumption in servings weekly

func CalculateCholMMOLValue

func CalculateCholMMOLValue(value float64, unit string) float64

CalculateCholMMOLValue to convert value into mmol/L

func CalculateDietConsumption

func CalculateDietConsumption(value int, frequency string) int

CalculateDietConsumption in servings weekly

func CalculateExercise

func CalculateExercise(value int, unit, frequency, intensity string) int

CalculateExercise to minutes and moderate type weekly

func CalculateLength

func CalculateLength(value float64, unit, toUnit string) float64

CalculateLength to convert units

func CalculateMMOLValue

func CalculateMMOLValue(value float64, unit string) float64

CalculateMMOLValue to convert value into mmol/L

func ConvertAge

func ConvertAge(age float64) int

ConvertAge function

func ConvertCholesterol

func ConvertCholesterol(cholesterol float64, unit string) float64

ConvertCholesterol function

func ConvertLength

func ConvertLength(length float64, unit string) float64

ConvertLength function

func ConvertSbp

func ConvertSbp(sbp int) int

ConvertSbp function

func ConvertWeight

func ConvertWeight(weight float64, unit string) float64

ConvertWeight function

func Float64InBetween added in v1.5.0

func Float64InBetween(num, from, to float64) bool

Float64InBetween function

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory function

func GetFullGenderText

func GetFullGenderText(g string) string

GetFullGenderText returns full gender text

func GetMD5Hash

func GetMD5Hash(text string) string

GetMD5Hash returns md5 hash of a string

func IntInBetween added in v1.5.0

func IntInBetween(num, from, to int) bool

IntInBetween function

func JoinStrings

func JoinStrings(elem ...string) string

JoinStrings returns a string composed from a given set of args.

func JoinStringsSep

func JoinStringsSep(sep string, elem ...string) string

JoinStringsSep returns a string composed from the second and other args, separated by the separator as first arg.

func ParseGuidesFiles

func ParseGuidesFiles(c echo.Context) (map[string][]byte, error)

ParseGuidesFiles function

func SliceContainsAnyString

func SliceContainsAnyString(s, matches []string) bool

SliceContainsAnyString returns true if any string of the given list is found

func SliceContainsString

func SliceContainsString(s []string, a string) (int, bool)

SliceContainsString returns idx and true if a found in s. Otherwise -1 and false.

func SliceStringEqual

func SliceStringEqual(a, b []string) bool

SliceStringEqual performs a simple check for equality for slices of strings.

func SliceStringUnique

func SliceStringUnique(original []string, caseSensitive bool) []string

SliceStringUnique returns a slice of unique strings by discarding duplicates from the original.

func StrAfterSubstr

func StrAfterSubstr(str, substr string) string

StrAfterSubstr returns a string following after a given substr.

func StrBeforeSubstr

func StrBeforeSubstr(str, substr string) string

StrBeforeSubstr returns a string preceding a given substr.

func StrWithSubstrMaxLen

func StrWithSubstrMaxLen(str, substr string, maxLen, addLen int) string

StrWithSubstrMaxLen returns a string containing a given substr. The returned string is no longer than maxLen.

If the original str is longer than maxLen, the returned string is: - if str starts with substr => result is str up to maxLen - if str ends with substr => result is str from len-maxLen up to the end - if str contains substr in the middle => substr gets surrounded by addLen such that maxLen = addLen + len(substr) addLen

func StrWithSubstrMaxLenIdx

func StrWithSubstrMaxLenIdx(str, substr string, idx, maxLen, addLen int) string

StrWithSubstrMaxLenIdx returns a string containing a given substr.

func StringBetweenDelimiters

func StringBetweenDelimiters(s, leftDelimiter, rightDelimiter string) string

StringBetweenDelimiters will return the text between the given delimiters

Types

type Country

type Country struct {
	Name   string
	Region string
}

Country object

type CountryCode

type CountryCode struct {
	Countries map[string]Country `json:"countries"`
}

CountryCode map

func Countries

func Countries(countriesPath string) CountryCode

Countries returns list of countries

Jump to

Keyboard shortcuts

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