gods: github.com/emirpasic/gods/utils Index | Files

package utils

import "github.com/emirpasic/gods/utils"

Package utils provides common utility functions.

Provided functionalities: - sorting - comparators

Index

Package Files

comparator.go sort.go utils.go

func ByteComparator Uses

func ByteComparator(a, b interface{}) int

ByteComparator provides a basic comparison on byte

func Float32Comparator Uses

func Float32Comparator(a, b interface{}) int

Float32Comparator provides a basic comparison on float32

func Float64Comparator Uses

func Float64Comparator(a, b interface{}) int

Float64Comparator provides a basic comparison on float64

func Int16Comparator Uses

func Int16Comparator(a, b interface{}) int

Int16Comparator provides a basic comparison on int16

func Int32Comparator Uses

func Int32Comparator(a, b interface{}) int

Int32Comparator provides a basic comparison on int32

func Int64Comparator Uses

func Int64Comparator(a, b interface{}) int

Int64Comparator provides a basic comparison on int64

func Int8Comparator Uses

func Int8Comparator(a, b interface{}) int

Int8Comparator provides a basic comparison on int8

func IntComparator Uses

func IntComparator(a, b interface{}) int

IntComparator provides a basic comparison on int

func RuneComparator Uses

func RuneComparator(a, b interface{}) int

RuneComparator provides a basic comparison on rune

func Sort Uses

func Sort(values []interface{}, comparator Comparator)

Sort sorts values (in-place) with respect to the given comparator.

Uses Go's sort (hybrid of quicksort for large and then insertion sort for smaller slices).

func StringComparator Uses

func StringComparator(a, b interface{}) int

StringComparator provides a fast comparison on strings

func TimeComparator Uses

func TimeComparator(a, b interface{}) int

TimeComparator provides a basic comparison on time.Time

func ToString Uses

func ToString(value interface{}) string

ToString converts a value to string.

func UInt16Comparator Uses

func UInt16Comparator(a, b interface{}) int

UInt16Comparator provides a basic comparison on uint16

func UInt32Comparator Uses

func UInt32Comparator(a, b interface{}) int

UInt32Comparator provides a basic comparison on uint32

func UInt64Comparator Uses

func UInt64Comparator(a, b interface{}) int

UInt64Comparator provides a basic comparison on uint64

func UInt8Comparator Uses

func UInt8Comparator(a, b interface{}) int

UInt8Comparator provides a basic comparison on uint8

func UIntComparator Uses

func UIntComparator(a, b interface{}) int

UIntComparator provides a basic comparison on uint

type Comparator Uses

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

Comparator will make type assertion (see IntComparator for example), which will panic if a or b are not of the asserted type.

Should return a number:

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

Package utils imports 4 packages (graph) and is imported by 139 packages. Updated 2019-01-27. Refresh now. Tools for package owners.