Documentation
¶
Overview ¶
Package structset implements helper functions that involves structs
Index ¶
- func CachedFieldIndexes(structType reflect.Type) map[string]int
- func GetStructFieldNames(Struct interface{}) []string
- func GetStructFieldTagMap(Struct interface{}, keyTag string, valueTag string) map[string]string
- func GetStructFieldTagValues(Struct interface{}, tag string) []string
- func ScanRow(rows *sql.Rows, columns []string, indexes map[string]int, dest any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CachedFieldIndexes ¶ added in v0.1.1
CachedFieldIndexes is like fieldIndexes, but cached per struct type.
func GetStructFieldNames ¶
func GetStructFieldNames(Struct interface{}) []string
GetStructFieldNames returns all fields in a given struct
func GetStructFieldTagMap ¶
GetStructFieldTagMap returns a map of tags using keyTag as map key and valueTag as map value
func GetStructFieldTagValues ¶
GetStructFieldTagValues returns all tag names in a given struct for a given tag Note: id tag which is auto increment column in DB will not be returned
func ScanRow ¶
ScanRow is a cut-down version of the proposed Rows.ScanRow method. It currently only handles dest being a (pointer to) struct, and does not handle embedded fields. See https://github.com/golang/go/issues/61637
Types ¶
This section is empty.