treflect

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainTag

func ContainTag(item interface{}, tag string) bool

ContainTag 判断结构体是否含有特定的json内容

func Copy

func Copy(src interface{}) interface{}

Copy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type. note: can't copy unexported field: https://stackoverflow.com/questions/38369350/how-to-clone-a-structure-with-unexported-field

func DeepCopySlice

func DeepCopySlice[T any](data []T, ns ...int) []T

DeepCopySlice 深度复制切片

func GetFieldValue

func GetFieldValue(item interface{}, fieldName string) (reflect.Value, error)

func SetField

func SetField(item interface{}, fieldName string, value interface{}) error

func ToAnyMap

func ToAnyMap(item interface{}, skip ...string) map[string]interface{}

ToAnyMap 把任意数据转换为字符串形式的任意map

func ToAnyMapDeep

func ToAnyMapDeep(item interface{}, skip ...string) map[string]interface{}

ToAnyMapDeep 把任意数据递归转换为字符串形式的任意map

func ToAnyMapWithJson

func ToAnyMapWithJson(item interface{}, skip ...string) map[string]interface{}

ToAnyMapWithJson 把任意数据转换为json字符串形式的任意map

func ToAnyMapWithJsonDeep

func ToAnyMapWithJsonDeep(item interface{}, skip ...string) map[string]interface{}

ToAnyMapWithJsonDeep 把任意数据递归转换为json字符串形式的任意map

Types

type Interface

type Interface interface {
	DeepCopy() interface{}
}

Interface for delegating copy process to type

Jump to

Keyboard shortcuts

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