douxu3315
2018-02-07 11:52如何列出指向golang结构所有字段的指针?
Is there a good way in golang to pass all fields of some struct instance c
?
I'm looking for some syntactic sugar functionality, so that instead of doing this:
method(&c.field1, &c.field2, &c.field3, &c.field4, &c.field5, ...)
I could do this:
method(FieldsPointers(c)...)
I'm rather new to golang and still learning the basics, if there is no good way to do what I want for a good reason, I'd appreciate an explanation as to why.
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- 使用反射设置指向字段的指针
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 1个回答
- 如何列出指向golang结构所有字段的指针?
- struct
- 1个回答
- 通过反射将接口的值设置为指向struc的类型指针的struct字段
- reflection
- 1个回答
- Golang-通过接口获取指向结构字段的指针
- reflection
- pointers
- 1个回答
- golang反射,获取指向结构字段值的指针
- sql
- reflection
- 1个回答
换一换