README

go-xray

Go Report Card Documentation license GitHub version GitHub issues

This is a Golang library with reflection related functions which I use in my different projects.

Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name(obj interface{}) string

    Name returns the name of an object

    func Properties

    func Properties(obj interface{}) ([]string, error)

      Properties returns the struct fields names list. obj can whether be a structure or pointer to structure.

      func PropertiesAsMap

      func PropertiesAsMap(obj interface{}) (map[string]interface{}, error)

        PropertiesAsMap returns the properties of an item as a map

        func Property

        func Property(obj interface{}, fieldName string) (interface{}, error)

          Property returns the specific property of obj

          func Tags

          func Tags(obj interface{}, tagname string) (map[string]string, error)

            Tags lists the struct tag fields. obj can whether be a structure or pointer to structure.

            Types

            type KeyValue

            type KeyValue struct {
            	Key   string
            	Value interface{}
            }

              KeyValue abstracts key with a value

              func (*KeyValue) String

              func (kv *KeyValue) String() string

                String returns the key value pair in the form <key>=<value>