utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndiciesOfChar

func IndiciesOfChar(input string, char rune) []int

func IntMax

func IntMax(a int, b int) int

func IntMin

func IntMin(a int, b int) int

func ModAdd

func ModAdd(value int, accumulator int, base int) (int, int)

Adds 2 numbers (either positive or negative) and returns the mod and rollover count.

Types

type Logger

type Logger interface {
	Infof(format string, args ...interface{})
	Debugf(format string, args ...interface{})
}

Basic logging interface

type NoOpLogger

type NoOpLogger struct {
}

NoOpLogger matches the Logger interface and does nothing if no logging is desired

func (NoOpLogger) Debugf

func (NoOpLogger) Debugf(format string, args ...interface{})

func (NoOpLogger) Infof

func (NoOpLogger) Infof(format string, args ...interface{})

type TestLogger

type TestLogger struct {
	TestPrefix string
	Tester     *testing.T
}

TestLogger is to be used with the *testing.T.Log function for logging in test

func (TestLogger) Debugf

func (logger TestLogger) Debugf(format string, args ...interface{})

func (TestLogger) Infof

func (logger TestLogger) Infof(format string, args ...interface{})

type ZipResult

type ZipResult[R any] struct {
	First  R
	Second R
}

func Zip

func Zip[R any](input1 []R, input2 []R, emptyMaker func() R) []ZipResult[R]

Jump to

Keyboard shortcuts

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