Sphire Mantis API Documentation

Sphire Mantis' API Documentation

View the Project on GitHub sphireinc/Mantis

Go Report Card Go Reference

helper

import "github.com/sphireinc/mantis/helper"

Index

func AtoiWithDefault

func AtoiWithDefault(value string, defaultValue int) int

AtoiWithDefault same as strconv.Atoi except only returns the value or a default value if nil

func Average

func Average[T IntFloat](args ...T) float64

Average calculates the average value of a set of numbers

func CelsiusToFahrenheit

func CelsiusToFahrenheit(degrees float32) float32

CelsiusToFahrenheit converts C to F

func Default

func Default[T comparable](originalVal T, defaultVal T) T

Default returns the defaultVal given if originalVal is empty/nil

func DeferFileClose

func DeferFileClose(file *os.File)

DeferFileClose prevents non-closure file closing error

func FahrenheitToCelsius

func FahrenheitToCelsius(degrees float32) float32

FahrenheitToCelsius converts F to C

func FromPtr

func FromPtr[T any](original *T) T

FromPtr returns a pointer value for the value passed in.

func Reverse

func Reverse(s string) string

Reverse a string

func StringToBool

func StringToBool(boolean string) bool

StringToBool same as strconv.ParseBool except hides the error (returns false)

func ToPtr

func ToPtr[T any](original T) *T

ToPtr returns a pointer value for the value passed in.

type IntFloat

IntFloat is an interface for numeric types

type IntFloat interface {
    float32 | float64 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

Generated by gomarkdoc