aliU

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(s string, a []string) bool

func ContentTypeFromFileName

func ContentTypeFromFileName(filename string) (string, error)

func DayStr added in v0.2.2

func DayStr(t time.Time) string

func DotX

func DotX(a []float64, b float64) []float64

func DotXX

func DotXX(a [][]float64, b float64) [][]float64

func ExistsOnDisk

func ExistsOnDisk(path string) (bool, error)

func FancyRandStr

func FancyRandStr(length int) string

func FastFail added in v0.2.2

func FastFail(failure string, args ...int)

FastFail is a GomegaFailHandler that, when run with `go test -failfast` , fails immidiately and halts other long running tests prints the line number of the test that failed from conversation with @onsi https://github.com/onsi/gomega/issues/660 this makes it possible to fail fast and not wait for all the tests to finish if they are going to fail usage: in your test, as the first line of the test, add this:

RegisterFailHandler(aliU.FastFail)

func FiveCharPrefix

func FiveCharPrefix(s string) string

func FliterFloat64Array

func FliterFloat64Array(a []float64, filter func(f float64) bool) []float64

func Folderify

func Folderify(filename string) string

func Mapify

func Mapify(thing interface{}) (map[string]interface{}, error)

Mapify converts any struct to a json friendly map of string to interface it expects the thing to have autogenerated json tags float64 are supported while ints are not Damn and embedded strucs are not flattened by default :p

func MaxInt

func MaxInt(a, b int) int

func MaxInt64

func MaxInt64(a, b int64) int64

func MeanFloat64

func MeanFloat64(a []float64) float64

func MeanInt64 added in v0.2.1

func MeanInt64(a []int64) float64

func MedianFloat64

func MedianFloat64(input []float64) (median float64)

func MedianInt64 added in v0.2.1

func MedianInt64(input []int64) (median float64)

it returns the median of a slice of int64 it returns float64 because sometimes the median is not an int

func MinInt

func MinInt(a, b int) int

func MinInt64

func MinInt64(a, b int64) int64

func NextID

func NextID() string

NextID is used to generate sessionid s uses the time reverses it, to avoid problems like "hot hashes" and busy shards an overkill but a good practice

func NextId

func NextId() string

used to generate sessionid s uses the time reverses it, to avoid problems like "hot hashes" and busy shards and over kill but a good practice

func RandStr100

func RandStr100(length int) string

func RandomString

func RandomString(length int, includeUpperCase bool, includeDigits bool) string

func SleepItOff

func SleepItOff(d time.Duration)

func Spinner

func Spinner() string

func StoragePathFromURL

func StoragePathFromURL(url *url.URL) (string, error)

func StringArrayContains

func StringArrayContains(a []string, s string) bool

func StringArraysHaveSameElements

func StringArraysHaveSameElements(a, b []string) bool

func UniqueArray

func UniqueArray[K comparable](a []K) []K

func UniqueIDForBlob

func UniqueIDForBlob(blob []byte) string

func Unzipb64

func Unzipb64(s string) (string, error)

func Zipb64

func Zipb64(s string) string

Types

type SortableFloat64Array

type SortableFloat64Array []float64

func (SortableFloat64Array) Len

func (a SortableFloat64Array) Len() int

func (SortableFloat64Array) Less

func (a SortableFloat64Array) Less(i, j int) bool

func (SortableFloat64Array) Swap

func (a SortableFloat64Array) Swap(i, j int)

type SortableInt64Array added in v0.2.1

type SortableInt64Array []int64

func (SortableInt64Array) Len added in v0.2.1

func (a SortableInt64Array) Len() int

func (SortableInt64Array) Less added in v0.2.1

func (a SortableInt64Array) Less(i, j int) bool

func (SortableInt64Array) Swap added in v0.2.1

func (a SortableInt64Array) Swap(i, j int)

type SortableStringArray

type SortableStringArray []string

func (SortableStringArray) Len

func (a SortableStringArray) Len() int

func (SortableStringArray) Less

func (a SortableStringArray) Less(i, j int) bool

func (SortableStringArray) Swap

func (a SortableStringArray) Swap(i, j int)

Jump to

Keyboard shortcuts

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