utils

package
v2.37.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationSecondToInt added in v2.12.0

func DurationSecondToInt(d *time.Duration) *int

func GetWriter

func GetWriter(consumer func(string)) io.WriteCloser

GetWriter creates an io.Writer that will actually split by line and format by LogConsumer

func StringToBool added in v2.3.0

func StringToBool(s string) bool

StringToBool converts a string to a boolean ignoring errors

Types

type SafeBuffer added in v2.12.0

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

SafeBuffer is a thread safe version of bytes.Buffer

func (*SafeBuffer) Bytes added in v2.12.0

func (b *SafeBuffer) Bytes() []byte

Bytes is a thread safe version of bytes.Buffer::Bytes

func (*SafeBuffer) Read added in v2.12.0

func (b *SafeBuffer) Read(p []byte) (n int, err error)

Read is a thread safe version of bytes.Buffer::Read

func (*SafeBuffer) RequireEventuallyContains added in v2.12.0

func (b *SafeBuffer) RequireEventuallyContains(t testing.TB, v string)

RequireEventuallyContains is a thread safe eventual checker for the buffer content

func (*SafeBuffer) String added in v2.12.0

func (b *SafeBuffer) String() string

String is a thread safe version of bytes.Buffer::String

func (*SafeBuffer) Write added in v2.12.0

func (b *SafeBuffer) Write(p []byte) (n int, err error)

Write is a thread safe version of bytes.Buffer::Write

type Set added in v2.16.0

type Set[T comparable] map[T]struct{}

func NewSet added in v2.21.0

func NewSet[T comparable](v ...T) Set[T]

func (Set[T]) Add added in v2.16.0

func (s Set[T]) Add(v T)

func (Set[T]) AddAll added in v2.19.0

func (s Set[T]) AddAll(v ...T)

func (Set[T]) Clear added in v2.16.0

func (s Set[T]) Clear()

func (Set[T]) Diff added in v2.21.0

func (s Set[T]) Diff(other Set[T]) Set[T]

func (Set[T]) Elements added in v2.16.0

func (s Set[T]) Elements() []T

func (Set[T]) Has added in v2.21.0

func (s Set[T]) Has(v T) bool

func (Set[T]) Remove added in v2.16.0

func (s Set[T]) Remove(v T) bool

func (Set[T]) RemoveAll added in v2.20.0

func (s Set[T]) RemoveAll(elements ...T)

func (Set[T]) Union added in v2.21.0

func (s Set[T]) Union(other Set[T]) Set[T]

Jump to

Keyboard shortcuts

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