types

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 6 Imported by: 10

README

pipeline status coverage report License MIT

types

Golang type extensions module.

This software is provided as-is, without any warranty of correctness or merchantability. I created it to make my life a little easier for my own personal projects. Use at your own peril! If you happen to find it useful, please fork it, as anything may change at any time whenever I feel like it!

Functions

- func ToBool(vars ...interface{}) bool
- func ToInt64(vars ...interface{}) int64
- func ToInt(vars ...interface{}) int
- func ToInt8(vars ...interface{}) int8
- func ToInt16(vars ...interface{}) int16
- func ToInt32(vars ...interface{}) int32
- func ToUInt64(vars ...interface{}) uint
- func ToUInt(vars ...interface{}) uint
- func ToUInt8(vars ...interface{}) uint8
- func ToUInt16(vars ...interface{}) uint16
- func ToUInt32(vars ...interface{}) uint32
- func ToFloat64(vars ...interface{}) float64
- func ToFloat32(vars ...interface{}) float32
- func Float64Equal(f1, f2 float64, dec ...uint) bool
- func RoundFloat64Dec(f float64, dec uint) float64
- func ToString(vars ...interface{}) string
- func SliceContains(sl []string, s string) bool
- func ToDuration(vars ...interface{}) time.Duration
- func Equal(v1, v2 interface{}) bool
- func TypeSupported(in interface{}) bool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(v1, v2 interface{}) bool

Equal returns true if the parameters contain equal values

func Float64Equal

func Float64Equal(f1, f2 float64, dec ...uint) bool

Float64Equal returns true if the floating point values are equal up to including the given number of decimals if no decimals are supplied the function will compare up to including the 6th decimal

func RoundFloat64Dec

func RoundFloat64Dec(f float64, dec uint) float64

RoundFloat64Dec rounds the parameter on the given number of decimals

func SliceContains

func SliceContains(sl []string, s string) bool

SliceContains returns true if the slice of strings contains the given string

func ToBool

func ToBool(vals ...interface{}) bool

ToBool converts the first convertible parameter to a boolean nil, empty strings and strings containing a pipe symbol are skipped

func ToDuration

func ToDuration(vars ...interface{}) time.Duration

ToDuration converts the first convertible parameter to a time.Duration nil, non-parsable strings and unsupported types are skipped

func ToFloat32

func ToFloat32(vals ...interface{}) float32

ToFloat32 converts the first convertible parameter to a float32 nil and non-parsable strings are skipped

func ToFloat64

func ToFloat64(vals ...interface{}) float64

ToFloat64 converts the first convertible parameter to a float64 nil and non-parsable strings are skipped

func ToInt

func ToInt(vals ...interface{}) int

ToInt converts the first convertible parameter to an int nil and non-parsable strings are skipped

func ToInt16

func ToInt16(vals ...interface{}) int16

ToInt16 converts the first convertible parameter to an int16 nil and non-parsable strings are skipped

func ToInt32

func ToInt32(vals ...interface{}) int32

ToInt32 converts the first convertible parameter to an int32 nil and non-parsable strings are skipped

func ToInt64

func ToInt64(vals ...interface{}) int64

ToInt64 converts the first convertible parameter to an int64 nil and non-parsable strings are skipped

func ToInt8

func ToInt8(vals ...interface{}) int8

ToInt8 converts the first convertible parameter to an int8 nil and non-parsable strings are skipped

func ToString

func ToString(vars ...interface{}) string

ToString converts the first convertible parameter to a string nil and unsupported types are skipped

func ToUInt

func ToUInt(vals ...interface{}) uint

ToUInt converts the first convertible parameter to an uint nil and non-parsable strings are skipped

func ToUInt16

func ToUInt16(vals ...interface{}) uint16

ToUInt16 converts the first convertible parameter to an uint16 nil and non-parsable strings are skipped

func ToUInt32

func ToUInt32(vals ...interface{}) uint32

ToUInt32 converts the first convertible parameter to an uint32 nil and non-parsable strings are skipped

func ToUInt64

func ToUInt64(vals ...interface{}) uint64

ToUInt64 converts the first convertible parameter to a uint64 nil and non-parsable strings are skipped

func ToUInt8

func ToUInt8(vals ...interface{}) uint8

ToUInt8 converts the first convertible parameter to an uint8 nil and non-parsable strings are skipped

func TypeSupported

func TypeSupported(in interface{}) bool

TypeSupported returns true if the given parameter is a supported variant type

Types

This section is empty.

Jump to

Keyboard shortcuts

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