Starstruct
Explore the following sections to learn more:
starstruct
import "github.com/gemini-oss/rego/pkg/common/starstruct"
pkg/common/starstruct/struct.go
Index
- func DerefPointers(val reflect.Value) (reflect.Value, error)
- func FlattenStructFields(item interface{}, fields *[]string) ([][]string, error)
- func GenerateFieldNames(prefix string, val reflect.Value) (*[]string, error)
- func PrettyJSON(data interface{}) (string, error)
- func TableToStructs(data [][]string) ([]interface{}, error)
- func ToMap(item interface{}, includeZeroValues bool) (map[string]interface{}, error)
func DerefPointers
func DerefPointers(val reflect.Value) (reflect.Value, error)
DerefPointers takes a reflect.Value and recursively dereferences it if it’s a pointer.
func FlattenStructFields
func FlattenStructFields(item interface{}, fields *[]string) ([][]string, error)
FlattenStructFields parses a struct and its nested fields, if any, to a flat slice. It also updates the input fields with any new subfields found.
func GenerateFieldNames
func GenerateFieldNames(prefix string, val reflect.Value) (*[]string, error)
GenerateFieldNames recursively generates field names from a struct, dereferencing pointers as needed, and returns a pointer to a slice of strings.
func PrettyJSON
func PrettyJSON(data interface{}) (string, error)
* Print a struct as a JSON string
func TableToStructs
func TableToStructs(data [][]string) ([]interface{}, error)
TableToStructs converts a [][]string into a slice of structs, with the first row as headers.
func ToMap
func ToMap(item interface{}, includeZeroValues bool) (map[string]interface{}, error)
Generated by gomarkdoc