syntax

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(src interface{}) interface{}

DeepCopy returns a deep copy of the given object.

func ExtractIntValue

func ExtractIntValue(s string, r *regexp.Regexp) (bool, int, error)

ExtractIntValue extract int value from a string according regexp.

func ExtractStringValue

func ExtractStringValue(s string, r *regexp.Regexp) (bool, string, error)

ExtractStringValue extract string value from a string according regexp.

func ParseBytesByType

func ParseBytesByType(b []byte, t reflect.Type) (reflect.Value, error)

ParseBytesByType parse []byte to a value with type t

func SetMapValue

func SetMapValue(src reflect.Value, dst reflect.Value)

SetMapValue set all key and value from src map to dst map, and the value of same key in the dst map will be overwritten

func SetSliceOrArrayValue

func SetSliceOrArrayValue(src reflect.Value, dst reflect.Value)

SetSliceOrArrayValue append src slice or array to the end of dst

func SimpleMergeTwoValues

func SimpleMergeTwoValues(src reflect.Value, dst reflect.Value) error

SimpleMergeTwoValues merge two value with same type, which includes 3 cases: 1. slice & array (or its pointer): append src slice to dst 2. map (or its pointer): src map will overwrite dst 3. other (or its pointer): set src by dst since SimpleMergeTwoValues is a "simple" one, there may exist some cases SimpleMergeTwoValues won't support, and a possible one is a struct with a map or slice member, we will not merge its member object. for example, consider src and dst with the same type of

type newType struct {
	a []string
}

and src is newType{"a":["2"]}, dst is newType{"a":["1"]}, the simple merge result is newType{"a":["2"]}, and not newType{"a":["1","2"]}

Types

type DeepCopiable added in v0.2.0

type DeepCopiable interface {
	DeepCopy() interface{}
}

DeepCopiable is an interface that can be implemented by types that need to customize their deep copy behavior.

type MergeValueFunc

type MergeValueFunc func(src reflect.Value, dst reflect.Value) error

MergeValueFunc is to merge src value to dst

type Mutex added in v0.4.0

type Mutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMutex added in v0.4.0

func NewMutex(emitter metrics.MetricEmitter) *Mutex

func NewMutexWithPeriod added in v0.4.0

func NewMutexWithPeriod(emitter metrics.MetricEmitter, period time.Duration) *Mutex

func (*Mutex) Lock added in v0.4.0

func (m *Mutex) Lock() int

func (*Mutex) Unlock added in v0.4.0

func (m *Mutex) Unlock()

type RWMutex added in v0.4.0

type RWMutex struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRWMutex added in v0.4.0

func NewRWMutex(emitter metrics.MetricEmitter) *RWMutex

func NewRWMutexWithPeriod added in v0.4.0

func NewRWMutexWithPeriod(emitter metrics.MetricEmitter, period time.Duration) *RWMutex

func (*RWMutex) Lock added in v0.4.0

func (rm *RWMutex) Lock() int

func (*RWMutex) RLock added in v0.4.0

func (rm *RWMutex) RLock() int

func (*RWMutex) RUnlock added in v0.4.0

func (rm *RWMutex) RUnlock()

func (*RWMutex) Unlock added in v0.4.0

func (rm *RWMutex) Unlock()

Jump to

Keyboard shortcuts

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