utils

package
v1.17.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DesensitizedArgs []string
View Source
var NetworkInterfaceName string

Functions

func CloseLogErrZap added in v1.7.8

func CloseLogErrZap(closer io.Closer, logger *zap.Logger)

func DistinctStringSlice

func DistinctStringSlice(s []string) []string

func Dos2UnixWriter

func Dos2UnixWriter(w io.Writer) io.WriteCloser

func GetOutBoundIP added in v1.9.8

func GetOutBoundIP() string

func GetOutBoundIPDefault added in v1.9.8

func GetOutBoundIPDefault() string

func InStringSlice

func InStringSlice(slice []string, s string) bool

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func IsHttpTimeout added in v1.9.8

func IsHttpTimeout(e error) bool

func IsPathExist

func IsPathExist(path string) bool

func IsTlsCertError added in v1.9.8

func IsTlsCertError(e error) bool

func JoinStringAny

func JoinStringAny(sep string, a ...fmt.Stringer) string

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func NewNoCrlfWriter added in v1.9.2

func NewNoCrlfWriter(w io.Writer) io.WriteCloser

func ReadFileLimited

func ReadFileLimited(p string, maxRead int64) ([]byte, error)

func Reverse added in v1.8.0

func Reverse[S ~[]E, E any](s S)

func Unix2DosWriter

func Unix2DosWriter(w io.Writer) io.WriteCloser

func UseLogger added in v1.7.13

func UseLogger(ctx context.Context) *zap.Logger

UseLogger returns *zap.Logger in the context. If no Logger exists, returns zap.NewNop()

func WithLogger added in v1.7.13

func WithLogger(ctx context.Context, logger *zap.Logger) context.Context

Types

type IntStack added in v1.9.8

type IntStack []int

func NewIntStack added in v1.9.8

func NewIntStack() *IntStack

func (*IntStack) Empty added in v1.9.8

func (i *IntStack) Empty() bool

func (*IntStack) Len added in v1.9.8

func (i *IntStack) Len() int

func (*IntStack) Peek added in v1.9.8

func (i *IntStack) Peek() int

func (*IntStack) Pop added in v1.9.8

func (i *IntStack) Pop() int

func (*IntStack) Push added in v1.9.8

func (i *IntStack) Push(el int)

type LogPipe added in v1.7.12

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

func NewLogPipe added in v1.7.12

func NewLogPipe(logger *zap.Logger, prefix string) *LogPipe

func (*LogPipe) Close added in v1.7.12

func (l *LogPipe) Close() error

func (*LogPipe) Write added in v1.7.12

func (l *LogPipe) Write(data []byte) (int, error)

type SuffixBuffer

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

func MkSuffixBuffer added in v1.7.11

func MkSuffixBuffer(capacity int) *SuffixBuffer

func (*SuffixBuffer) Bytes

func (r *SuffixBuffer) Bytes() (rs []byte)

func (*SuffixBuffer) Write

func (r *SuffixBuffer) Write(data []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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