structils

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Entries

func Entries(s interface{}) map[string]interface{}

Entries returns a map where the keys are strings representing the names of fields in a structure and the values of these keys are interfaces representing the values of these fields.

func GetMethod

func GetMethod(s interface{}, method string) reflect.Value

GetMethod returns the Reflect.Value of a method of the structure obtained by name, if the method does not exist, it returns Reflect.Value of nil.

func HasField

func HasField(s interface{}, field string) bool

HasField returns a boolean that determines whether there is a field with the name received as a parameter within the structure.

func HasMethod

func HasMethod(s interface{}, method string) bool

HasMethod determines if there is a method with the name received as a parameter in the structure.

func IsStruct

func IsStruct(s interface{}) reflect.Value

IsStruct validates whether the parameter is a valid structure or another type. Returns Reflect.Value of nil if not a valid structure, otherwise returns Reflect.Value of the received structure.

func Keys

func Keys(s interface{}) []string

Keys returns an iterable list of strings with the names of fields in a structure.

func Methods

func Methods(s interface{}) []string

Methods returns an iterable list of strings representing the names of a structure's methods.

func Name

func Name(s interface{}) string

Name returns the name of the identifier of the structure passed as a parameter, if it is not a structure, it returns an empty string.

func SetFieldValue

func SetFieldValue(s interface{}, key string, value interface{})

SetFieldValue sets the value of a field in a structure by name.

func Values

func Values(s interface{}) []interface{}

Values returns an iterable list of interfaces representing the values of fields in a structure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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