go-jobscraper/showstruct/showstruct.go

19 lines
294 B
Go
Raw Normal View History

2024-04-26 16:13:07 +00:00
package showstruct
import (
"fmt"
"reflect"
)
func Show(item any) {
val := reflect.ValueOf(item)
typ := val.Type()
for i := 0; i < val.NumField(); i++ {
field := val.Field(i)
fieldType := typ.Field(i)
fmt.Printf("Field : %s, Value: %v\n", fieldType.Name, field.Interface())
}
}