gstruct

package
v0.0.0-...-f3abbe6 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b interface{}) (bool, error)

compare map / structures ...

func HasZero

func HasZero(x interface{}) bool

Check if any field of a struct is initialized or not.

func IsStruct

func IsStruct(x interface{}) bool

Check if server is a struct or a pointer to struct

func IsZero

func IsZero(x interface{}) bool

Check if all fields of a struct is initialized or not.

func MemberNames

func MemberNames(x interface{}) []string

Convert the names of a struct to a []string (see "Names methods" for more info about fields)

func MemberValues

func MemberValues(x interface{}) []interface{}

func Members

func Members(x interface{}) []*structs.Field

Convert the values of a struct to a []*Field (see "Field methods" for more info about fields)

func StructName

func StructName(x interface{}) string

Return the struct name => "Server"

func StructPack

func StructPack(v interface{}, p []byte) error

func StructUnpack

func StructUnpack(p []byte, v interface{}) error

func ToMap

func ToMap(x interface{}) map[string]interface{}

Convert a struct to a map[string]interface{} => {"Name":"gopher", "ID":123456, "Enabled":true}

Types

This section is empty.

Jump to

Keyboard shortcuts

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