structs

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package structs provides reflection utilities to inspect structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldExported

func FieldExported(field *reflect.StructField, predicates ...ExportedPredicate) (exported bool)

FieldExported returns true if field name starts with uppercase

func FindField

func FindField(pointerToAField interface{}, pointerToAStruct interface{}) (field *reflect.StructField, found bool)

FindField compares the pointers (pointerToAField with all fields in pointerToAStruct)

func ListExportedFields

func ListExportedFields(val interface{}, predicates ...ExportedPredicate) []*reflect.StructField

ListExportedFields returns all fields of a structure that starts wit uppercase letter

func ListExportedFieldsPtrs

func ListExportedFieldsPtrs(val interface{}, predicates ...ExportedPredicate) (
	fields []*reflect.StructField, valPtrs []interface{})

ListExportedFieldsPtrs iterates struct fields and return slice of pointers to field values

Types

type ExportedPredicate

type ExportedPredicate func(field *reflect.StructField) bool

ExportedPredicate defines a callback (used in func FieldExported)

Jump to

Keyboard shortcuts

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