internal

package
v0.0.0-...-18b418f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToSet

func AddToSet[T comparable](set []T, add ...T) []T

func Banish

func Banish[T any](s []T, i int) []T

Banish removes the element at index, i, from the slice, s, in place

Banish returns a slice of length len(s) - 1

func Diff

func Diff[T comparable](s1 []T, s2 []T) []T

func Filter

func Filter[S ~[]T, T any](ts S, fn func(t T) bool) []T

func FilterMap

func FilterMap[T, V any](ts []T, fn func(T) (V, bool)) []V

func GlobbyHash

func GlobbyHash(charLimit int, dataToHash ...any) string

GlobbyHash Set charLimit to 0 to disable

func InsertFunc

func InsertFunc[S ~[]T, T any](ts S, t T, cmp func(a T, b T) int) S

func Map

func Map[T, V any](ts []T, fn func(T) V) []V

func MapToKeys

func MapToKeys[T comparable, V any](tMap map[T]V) []T

func MapToSliceMutate

func MapToSliceMutate[T comparable, X, V any](tMap map[T]X, fn func(T, X) V) []V

func MapToValues

func MapToValues[T comparable, V any](tMap map[T]V) []V

Takes a generic map and returns a slice of the values

func OnlyUnique

func OnlyUnique[T comparable](s []T) (rs []T)

func OracleReader

func OracleReader(r io.Reader, readerSize int64) ([]byte, error)

OracleReader is almost exactly like io.ReadAll, but if we know how long the content is, we can allocate the whole array up front, saving a bit of time (I hope)

func RecoverPanic

func RecoverPanic(preText string)

func Reduce

func Reduce[T, A any](ts []T, fn func(T, A) A, acc A) A

func SliceConvert

func SliceConvert[V, T any](ts []T) []V

SliceConvert Perform type assertion on slice

func Yoink

func Yoink[T any](s []T, i int) ([]T, T)

Yoink See Banish. Yoink is the same as Banish, but returns the value at i in addition to the shortened slice.

func YoinkFunc

func YoinkFunc[T any](s []T, fn func(f T) bool) (rs []T, rt T, re bool)

Types

type Stopwatch

type Stopwatch interface {
	Lap(tag ...any)
	Stop() time.Duration
	PrintResults(firstLapIsStart bool)
	GetTotalTime(firstLapIsStart bool) time.Duration
}

func NewStopwatch

func NewStopwatch(name string) Stopwatch

type WeblensHash

type WeblensHash struct {
	// contains filtered or unexported fields
}

func NewWeblensHash

func NewWeblensHash() *WeblensHash

func (*WeblensHash) Add

func (h *WeblensHash) Add(data []byte) error

func (*WeblensHash) Done

func (h *WeblensHash) Done(len int) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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