common

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentLeftDuration

func CurrentLeftDuration(startTime meta.Time, timeoutSec *int64) time.Duration

func FromJson

func FromJson(jsonStr string, objAddr interface{})

func FromJsonBytes

func FromJsonBytes(jsonBytes []byte, objAddr interface{})

func FromYaml

func FromYaml(yamlStr string, objAddr interface{})

func GetCallStack

func GetCallStack() string

func GetEnv added in v0.3.4

func GetEnv(key, fallback string) string

func GetPanicDetails

func GetPanicDetails(recoveredObj interface{}) string

func InitAll

func InitAll()

func InitLogger

func InitLogger()

func InitRandSeed

func InitRandSeed()

func Int32MapKeys added in v0.3.1

func Int32MapKeys(m map[int32]int32) []int32

func Int32SliceContains added in v0.2.4

func Int32SliceContains(n []int32, i int32) bool

func Int32ToString

func Int32ToString(i int32) string

func IsTimeout

func IsTimeout(leftDuration time.Duration) bool

func NewStopChannel

func NewStopChannel() <-chan struct{}

func NilBool

func NilBool() *bool

func NilInt32

func NilInt32() *int32

func PtrBool

func PtrBool(o bool) *bool

func PtrFloat64

func PtrFloat64(o float64) *float64

func PtrInt32

func PtrInt32(o int32) *int32

func PtrInt64

func PtrInt64(o int64) *int64

func PtrNow

func PtrNow() *meta.Time

func PtrString

func PtrString(o string) *string

func PtrUID

func PtrUID(o types.UID) *types.UID

func PtrUIDStr

func PtrUIDStr(s string) *types.UID

func Quote

func Quote(s string) string

func RandInt64

func RandInt64(min int64, max int64) int64

Rand in range [min, max]

func ReferEnvVar

func ReferEnvVar(name string) string

func SecToDuration

func SecToDuration(sec *int64) time.Duration

func SortInt32 added in v0.2.0

func SortInt32(n []int32)

func StringToInt32

func StringToInt32(s string) int32

func StringsContains

func StringsContains(s []string, e string) bool

func ToIndicesString

func ToIndicesString(indices []int32) string

func ToJson

func ToJson(obj interface{}) string

func ToJsonBytes

func ToJsonBytes(obj interface{}) []byte

func ToYaml

func ToYaml(obj interface{}) string

Types

type Empty

type Empty struct{}

type ImmutableSet

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

func NewImmutableSet

func NewImmutableSet(items ...T) ImmutableSet

func (ImmutableSet) Contains

func (s ImmutableSet) Contains(item T) bool

type KlogWriter

type KlogWriter struct{}

func (KlogWriter) Write

func (w KlogWriter) Write(data []byte) (n int, err error)

type Set

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

func NewSet

func NewSet(items ...T) Set

func (Set) Add

func (s Set) Add(item T) Set

func (Set) Contains

func (s Set) Contains(item T) bool

func (Set) Delete

func (s Set) Delete(item T) Set

func (Set) IsEmpty added in v0.2.0

func (s Set) IsEmpty() bool

func (Set) Items added in v0.2.0

func (s Set) Items() map[T]Empty

func (Set) String added in v0.3.1

func (s Set) String() string

type T

type T interface{}

Jump to

Keyboard shortcuts

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