starstruct

package
v0.0.0-...-7a4e58b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

pkg/common/starstruct/struct.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL