gutil

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: MIT Imports: 8 Imported by: 49

Documentation

Overview

Package gutil provides utility functions.

Package gutil provides utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparatorByte

func ComparatorByte(a, b interface{}) int

ComparatorByte provides a basic comparison on byte.

func ComparatorFloat32

func ComparatorFloat32(a, b interface{}) int

ComparatorFloat32 provides a basic comparison on float32.

func ComparatorFloat64

func ComparatorFloat64(a, b interface{}) int

ComparatorFloat64 provides a basic comparison on float64.

func ComparatorInt

func ComparatorInt(a, b interface{}) int

ComparatorInt provides a basic comparison on int.

func ComparatorInt16

func ComparatorInt16(a, b interface{}) int

ComparatorInt16 provides a basic comparison on int16.

func ComparatorInt32

func ComparatorInt32(a, b interface{}) int

ComparatorInt32 provides a basic comparison on int32.

func ComparatorInt64

func ComparatorInt64(a, b interface{}) int

ComparatorInt64 provides a basic comparison on int64.

func ComparatorInt8

func ComparatorInt8(a, b interface{}) int

ComparatorInt8 provides a basic comparison on int8.

func ComparatorRune

func ComparatorRune(a, b interface{}) int

ComparatorRune provides a basic comparison on rune.

func ComparatorString

func ComparatorString(a, b interface{}) int

ComparatorString provides a fast comparison on strings.

func ComparatorTime

func ComparatorTime(a, b interface{}) int

ComparatorTime provides a basic comparison on time.Time.

func ComparatorUint

func ComparatorUint(a, b interface{}) int

ComparatorUint provides a basic comparison on uint.

func ComparatorUint16

func ComparatorUint16(a, b interface{}) int

ComparatorUint16 provides a basic comparison on uint16.

func ComparatorUint32

func ComparatorUint32(a, b interface{}) int

ComparatorUint32 provides a basic comparison on uint32.

func ComparatorUint64

func ComparatorUint64(a, b interface{}) int

ComparatorUint64 provides a basic comparison on uint64.

func ComparatorUint8

func ComparatorUint8(a, b interface{}) int

ComparatorUint8 provides a basic comparison on uint8.

func Dump

func Dump(i ...interface{})

Dump prints variables <i...> to stdout with more manually readable.

func Export

func Export(i ...interface{}) string

Export returns variables <i...> as a string with more manually readable.

func IsEmpty

func IsEmpty(value interface{}) bool

IsEmpty checks given <value> empty or not. It returns false if <value> is: integer(0), bool(false), slice/map(len=0), nil; or else returns true.

func MapCopy added in v1.10.0

func MapCopy(data map[string]interface{}) (copy map[string]interface{})

MapCopy does memory from map <data> to <copy>.

func MapPossibleItemByKey added in v1.10.0

func MapPossibleItemByKey(data map[string]interface{}, key string) (string, interface{})

MapPossibleItemByKey tries to find the possible key-value pair for given key with or without cases or chars '-'/'_'/'.'/' '.

Note that this function might be of low performance.

func Throw

func Throw(exception interface{})

Throw throws out an exception, which can be caught be TryCatch or recover.

func TryCatch

func TryCatch(try func(), catch ...func(exception interface{}))

TryCatch implements try...catch... logistics.

Types

type Comparator

type Comparator func(a, b interface{}) int

Comparator is a function that compare a and b, and returns the result as int.

Should return a number:

negative , if a < b
zero     , if a == b
positive , if a > b

Jump to

Keyboard shortcuts

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