[英]How to get the fields of go struct
Lets say we have a User
type 让我们说我们有一个User
类型
type User struct {
FirstName string
LastName string
...
}
I need a function that returns []string
with the field names in it [FirstName, LastName, ...]
我需要一个函数返回[]string
其中包含字段名称[FirstName, LastName, ...]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.