reflect

package
v0.0.0-...-a32d5fc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterfaceType

type InterfaceType reflect.Type

InterfaceType is a type for an interface

func Interface

func Interface(t reflect.Type) (InterfaceType, error)

Interface will check that t is either an interface or an interface pointer. If it is an interface pointer, then the interface that is pointed to is returned. If it is not an interface, then an error is returned describing the actual type.

func ObjectInterface

func ObjectInterface(ptr interface{}) (InterfaceType, error)

ObjectInterface returns the extracted interface for the object reference. Note: that o must be a pointer.

type PackagePath

type PackagePath string

PackagePath represents a go package path

const NoPackage PackagePath = ""

NoPackage represents the "" package, which is for predeclared types and unnamed types

func ObjectPackage

func ObjectPackage(o interface{}) PackagePath

ObjectPackage returns the package the the specified object belongs to It only supports named types or pointers to named types. If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), then the package path will be the empty string.

func TypePackage

func TypePackage(t reflect.Type) PackagePath

TypePackage returns the package path that the type belongs to If the type is a pointer, then it returns the package for the pointer's element type

type StructType

type StructType reflect.Type

StructType is a type for a struct

func Struct

func Struct(t reflect.Type) (StructType, error)

Struct will check that t is either an struct or an struct pointer. If it is an struct pointer, then the struct that is pointed to is returned. If it is not an struct, then an error is returned describing the actual type.

type TypeName

type TypeName string

TypeName represents a go type name

Jump to

Keyboard shortcuts

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