Documentation ¶
Overview ¶
Package zreflect implements functions for reflection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fields ¶
Fields gets all exported fields for the struct t, as a slice of names, values, and tag options, in the order they are in the struct.
If tag is not an "" it will use the tag name as the field name, falling back to the field name if it's not set. Tags with a value of "-" will be skipped.
Fields will be skipped if the option given in skip is set in the tag.
It will panic if t is not a struct.
For example:
t := struct { One string `db:"one"` Two string `db:"two,noinsert"` Three int }{"xxx", "yyy", 42} Fields(t, "db", "noinsert")
Will return:
[]string{"one", "Three"} []any{"xxx", 42} [][]string{nil, []string{"noinsert"}}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.