syntax

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(src interface{}) interface{}

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

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

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

MergeValueFunc is to merge src value to dst

Jump to

Keyboard shortcuts

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