zutils

package
v0.0.0-...-e0d6b9e Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContains

func AssertContains(t *testing.T, contains string, msgAndArgs ...string)

func AssertEqual

func AssertEqual(t *testing.T, a, b interface{})

func AssertNil

func AssertNil(t *testing.T, object interface{})

func AssertNotNil

func AssertNotNil(t *testing.T, object interface{})

func Bool

func Bool(a bool) *bool

func BoolSlice

func BoolSlice(a []bool) []*bool

func BoolSliceValue

func BoolSliceValue(a []*bool) []bool

func BoolValue

func BoolValue(a *bool) bool

func Float32

func Float32(a float32) *float32

func Float32Slice

func Float32Slice(a []float32) []*float32

func Float32Value

func Float32Value(a *float32) float32

func Float32ValueSlice

func Float32ValueSlice(a []*float32) []float32

func Float64

func Float64(a float64) *float64

func Float64Slice

func Float64Slice(a []float64) []*float64

func Float64Value

func Float64Value(a *float64) float64

func Float64ValueSlice

func Float64ValueSlice(a []*float64) []float64

func InitLogMsg

func InitLogMsg(fieldMap map[string]string)

func Int

func Int(a int) *int

func Int16

func Int16(a int16) *int16

func Int16Slice

func Int16Slice(a []int16) []*int16

func Int16Value

func Int16Value(a *int16) int16

func Int16ValueSlice

func Int16ValueSlice(a []*int16) []int16

func Int32

func Int32(a int32) *int32

func Int32Slice

func Int32Slice(a []int32) []*int32

func Int32Value

func Int32Value(a *int32) int32

func Int32ValueSlice

func Int32ValueSlice(a []*int32) []int32

func Int64

func Int64(a int64) *int64

func Int64Slice

func Int64Slice(a []int64) []*int64

func Int64Value

func Int64Value(a *int64) int64

func Int64ValueSlice

func Int64ValueSlice(a []*int64) []int64

func Int8

func Int8(a int8) *int8

func Int8Slice

func Int8Slice(a []int8) []*int8

func Int8Value

func Int8Value(a *int8) int8

func Int8ValueSlice

func Int8ValueSlice(a []*int8) []int8

func IntSlice

func IntSlice(a []int) []*int

func IntValue

func IntValue(a *int) int

func IntValueSlice

func IntValueSlice(a []*int) []int

func PublishProgress

func PublishProgress(listener ProgressListener, event *ProgressEvent)

publishProgress

func SetLogChannel

func SetLogChannel(channel string)

func String

func String(a string) *string

func StringSlice

func StringSlice(a []string) []*string

func StringSliceValue

func StringSliceValue(a []*string) []string

func StringValue

func StringValue(a *string) string

func Uint

func Uint(a uint) *uint

func Uint16

func Uint16(a uint16) *uint16

func Uint16Slice

func Uint16Slice(a []uint16) []*uint16

func Uint16Value

func Uint16Value(a *uint16) uint16

func Uint16ValueSlice

func Uint16ValueSlice(a []*uint16) []uint16

func Uint32

func Uint32(a uint32) *uint32

func Uint32Slice

func Uint32Slice(a []uint32) []*uint32

func Uint32Value

func Uint32Value(a *uint32) uint32

func Uint32ValueSlice

func Uint32ValueSlice(a []*uint32) []uint32

func Uint64

func Uint64(a uint64) *uint64

func Uint64Slice

func Uint64Slice(a []uint64) []*uint64

func Uint64Value

func Uint64Value(a *uint64) uint64

func Uint64ValueSlice

func Uint64ValueSlice(a []*uint64) []uint64

func Uint8

func Uint8(a uint8) *uint8

func Uint8Slice

func Uint8Slice(a []uint8) []*uint8

func Uint8Value

func Uint8Value(a *uint8) uint8

func Uint8ValueSlice

func Uint8ValueSlice(a []*uint8) []uint8

func UintSlice

func UintSlice(a []uint) []*uint

func UintValue

func UintValue(a *uint) uint

func UintValueSlice

func UintValueSlice(a []*uint) []uint

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(level string, channel string, out io.Writer, template string) *Logger

func (*Logger) CloseLogger

func (logger *Logger) CloseLogger()

func (*Logger) GetFormatTemplate

func (logger *Logger) GetFormatTemplate() string

func (*Logger) GetIsopen

func (logger *Logger) GetIsopen() bool

func (*Logger) GetLastLogMsg

func (logger *Logger) GetLastLogMsg() string

func (*Logger) OpenLogger

func (logger *Logger) OpenLogger()

func (*Logger) PrintLog

func (logger *Logger) PrintLog(fieldMap map[string]string, err error)

func (*Logger) SetFormatTemplate

func (logger *Logger) SetFormatTemplate(template string)

func (*Logger) SetIsopen

func (logger *Logger) SetIsopen(isopen bool)

func (*Logger) SetLastLogMsg

func (logger *Logger) SetLastLogMsg(lastLogMsg string)

type ProgressEvent

type ProgressEvent struct {
	ConsumedBytes int64
	TotalBytes    int64
	RwBytes       int64
	EventType     ProgressEventType
}

ProgressEvent defines progress event

func NewProgressEvent

func NewProgressEvent(eventType ProgressEventType, consumed, total int64, rwBytes int64) *ProgressEvent

type ProgressEventType

type ProgressEventType int

ProgressEventType defines transfer progress event type

const (
	// TransferStartedEvent transfer started, set TotalBytes
	TransferStartedEvent ProgressEventType = 1 + iota
	// TransferDataEvent transfer data, set ConsumedBytes anmd TotalBytes
	TransferDataEvent
	// TransferCompletedEvent transfer completed
	TransferCompletedEvent
	// TransferFailedEvent transfer encounters an error
	TransferFailedEvent
)

type ProgressListener

type ProgressListener interface {
	ProgressChanged(event *ProgressEvent)
}

ProgressListener listens progress change

func GetProgressListener

func GetProgressListener(obj interface{}) ProgressListener

type ReaderTracker

type ReaderTracker struct {
	CompletedBytes int64
}

type UUID

type UUID [16]byte

Jump to

Keyboard shortcuts

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