reflect

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(source []interface{}, desc interface{}) []interface{}

Append for interface

func Contains

func Contains(search interface{}, target interface{}) bool

func ContainsIgnoreCase

func ContainsIgnoreCase(search string, target []string) bool

func Generate

func Generate(baseDir, pkgName string, models ...GenerateStruct)

func IsEmpty

func IsEmpty(a interface{}) bool

func IsHashAble

func IsHashAble(obj interface{}) bool

IsHashAble check the object whether it can be used as the key of the map

func MD5

func MD5(str string) string

func MD5Bytes

func MD5Bytes(data []byte) string

func MapToStruct

func MapToStruct(obj interface{}, data map[string]interface{}) error

func StructFields

func StructFields(s interface{}) []reflect.StructField

获取struct字段

func StructName

func StructName(s interface{}) string

获取struct name

func StructToMap

func StructToMap(obj interface{}, excludes ...string) map[string]interface{}

func StructTypeOf

func StructTypeOf(s interface{}) reflect.Type

func ToInterfaceArray

func ToInterfaceArray(array interface{}) []interface{}

ToInterfaceArray used to convert a array to array of interface

Types

type GenerateField

type GenerateField struct {
	CamelName   string
	NativeField reflect.StructField
}

type GenerateStruct

type GenerateStruct struct {
	Name   string
	Fields []GenerateField
}

func GetGenerateStruct

func GetGenerateStruct(s interface{}) GenerateStruct

type InputData

type InputData struct {
	PkgName   string
	Name      string // FuckShit
	CamelName string // fuckShit
	KebabName string // FuckShit -> fuck-shit
	Fields    []GenerateField
}

Jump to

Keyboard shortcuts

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