gutil

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

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 PrintStack

func PrintStack(skip ...int)

PrintStack prints to standard error the stack trace returned by runtime.Stack.

func Stack

func Stack(skip ...int) string

Stack returns a formatted stack trace of the goroutine that calls it. It calls runtime.Stack with a large enough buffer to capture the entire trace.

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