utils

package
v0.0.0-...-f683405 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  uint64 = 1
	KB        = B << 10
	MB        = KB << 10
	GB        = MB << 10
	TB        = GB << 10
	PB        = TB << 10
	EB        = PB << 10
)

Variables

This section is empty.

Functions

func AvgInt

func AvgInt(args ...int) float64

func AvgInt64

func AvgInt64(args ...int64) float64

func AvgUInt

func AvgUInt(args ...uint) float64

func AvgUInt64

func AvgUInt64(args ...uint64) float64

func FormatInt

func FormatInt(i int) string

func FormatInt64

func FormatInt64(i int64) string

func MaxInt

func MaxInt(args ...int) int

func MaxInt64

func MaxInt64(args ...int64) int64

func MaxUInt

func MaxUInt(args ...uint32) uint32

func MinInt

func MinInt(args ...int) int

func MinInt64

func MinInt64(args ...int64) int64

func MinUInt

func MinUInt(args ...uint) uint

func MinUInt64

func MinUInt64(args ...uint64) uint64

func ParseSafeFloat

func ParseSafeFloat(s string) float64

func ParseSafeInt

func ParseSafeInt(s string) int

func ParseSafeInt64

func ParseSafeInt64(s string) int64

func ParseSize

func ParseSize(expr string) (int64, error)

func RandomBetween

func RandomBetween(min, max int) int

RandomBetween Create random number between two ranges

func RandomString

func RandomString(length int, option RandomStringOp) string

func ReplaceArray

func ReplaceArray(input string, needles []string, replace []string) string

func SumInt

func SumInt(args ...int) int

func SumInt64

func SumInt64(args ...int64) int64

func SumUInt

func SumUInt(args ...uint) uint

SumUInt Sum of uint32

func SumUInt64

func SumUInt64(args ...uint64) uint64

Types

type RandomStringOp

type RandomStringOp int
const (
	LOWER_CASE     RandomStringOp = 1
	UPPER_CASE     RandomStringOp = 2
	RANDOM_CASE    RandomStringOp = 3
	ALPHANUM       RandomStringOp = 4
	NUMBERS        RandomStringOp = 5
	ALPHANUM_SIGNS RandomStringOp = 6
)

type String

type String string

func (String) Contains

func (s String) Contains(match string) bool

func (String) ContainsRegex

func (s String) ContainsRegex(match string) bool

func (String) EndsWith

func (s String) EndsWith(match string) bool

func (String) Fields

func (s String) Fields() []string

func (String) Replace

func (s String) Replace(find, replace string) String

func (String) Split

func (s String) Split(splitter string) []string

func (String) SplitBy

func (s String) SplitBy(splitter ...string) []string

func (String) StartsWith

func (s String) StartsWith(match string) bool

func (String) String

func (s String) String() string

func (String) Title

func (s String) Title() String

func (String) Trim

func (s String) Trim(args ...string) String

func (String) TrimLeft

func (s String) TrimLeft(args ...string) String

func (String) TrimRight

func (s String) TrimRight(args ...string) String

func (String) Truncate

func (s String) Truncate(length int, more string) String

func (String) TruncateWord

func (s String) TruncateWord(length int, more string) String

Jump to

Keyboard shortcuts

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