utils

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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 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