Discover Packages
github.com/Goldziher/go-utils
structutils
package
Version:
v1.2.4
Opens a new window with list of versions in this module.
Published: Aug 10, 2022
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func ForEach[T interface{}](structInstance T, function func(key string , value interface{}, tag reflect .StructTag ))
ForEach given a struct, calls the passed in function with each visible struct field's name, value and tag.
func ToMap[T interface{}](structInstance T, structTags ...string ) map[string ]any
ToMap given a struct, converts it to a map[string]any.
This function also takes struct tag names as optional parameters - if passed in, the struct tags will be used to remap or omit values.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.