util

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff added in v0.9.0

func Diff(data1, data2 []byte) ([]byte, error)

func NewSafeTemplate added in v0.11.0

func NewSafeTemplate(templateName string) *template.Template

NewTemplate returns an instance of a Go template wired up with the Sprig template functions.

func PreProcessModRuleGoTemplate added in v0.7.0

func PreProcessModRuleGoTemplate(template string) string

PreProcessModRuleGoTemplate converts special tokens such as .#0 to .I0 which are actual properties on the ModRule golang template context.

Types

type NamePool

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

NamePool - represents a pool of randomly generated strings.

func NewNamePool

func NewNamePool(size int) *NamePool

NewNamePool - return a newly instantiated NamePool

func (*NamePool) GetNextName

func (np *NamePool) GetNextName() string

GetNextName returns the next randomly generated name.

func (*NamePool) ResetIndex

func (np *NamePool) ResetIndex()

ResetIndex resets the internal incremental index.

type TLogger

type TLogger interface {
	Logf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

TLogger is an interface which implements Logf, Errorf, and Fatalf.

type TestLogger

type TestLogger struct {
	TLogger TLogger
}

TestLogger is a logr.Logger that prints through a testing.T object. Only error logs will have any effect.

func (TestLogger) Enabled

func (TestLogger) Enabled() bool

Enabled returns false.

func (TestLogger) Error

func (log TestLogger) Error(err error, msg string, args ...interface{})

Error prints an error.

func (TestLogger) Info

func (TestLogger) Info(_ string, _ ...interface{})

Info does nothing.

func (TestLogger) V

func (log TestLogger) V(v int) logr.InfoLogger

V returns this log.

func (TestLogger) WithName

func (log TestLogger) WithName(_ string) logr.Logger

WithName returns this log.

func (TestLogger) WithValues

func (log TestLogger) WithValues(_ ...interface{}) logr.Logger

WithValues returns this log.

Jump to

Keyboard shortcuts

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