structdump

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonTagName

func JsonTagName(f reflect.StructField) string

func StructFieldName

func StructFieldName(f reflect.StructField) string

Types

type NameFunc

type NameFunc func(reflect.StructField) string

type StructDump

type StructDump struct {
	StopTypes []string
	Output    io.Writer
	NameFunc  NameFunc
	// contains filtered or unexported fields
}

func (StructDump) Dump

func (sd StructDump) Dump(t reflect.Type)
Example
package main

import (
	"reflect"

	"github.com/encero/structdump"
)

func main() {
	type SimpleType struct {
		AnInt         int
		AnString      string
		AnStringSlice []string
	}

	dumper := structdump.StructDump{}

	dumper.Dump(reflect.TypeOf(SimpleType{}))

}
Output:

SimpleType.AnInt int
SimpleType.AnString string
SimpleType.AnStringSlice[] string

Jump to

Keyboard shortcuts

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