x

package
v0.0.0-...-8352b7d Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIncorrectType indicates that the provided example is not of the
	// correct type family.
	ErrIncorrectType = errors.New("must be a pointer")
)

Functions

func Nil

func Nil(v interface{}) bool

Nil returns true if v is nil, respecting the various caveats of nullable types that don't "equal" nil when boxed by interface{}.

func ValueOf

func ValueOf(v interface{}) (reflect.Value, bool)

ValueOf returns the reflect.Value of v if it is not nil, respecting the various caveats of nullable types that don't "equal" nil when boxed by interface{}.

Types

type TypeExample

type TypeExample struct {
	// contains filtered or unexported fields
}

TypeExample is useful to check if other types can be assigned to a given type using an example like (*MyType)(nil).

func MakeTypeExample

func MakeTypeExample(example interface{}) (TypeExample, error)

MakeTypeExample returns a new TypeExample given the passed example value, or returns an error. The passed example must be a pointer type.

func (*TypeExample) AssignableFrom

func (e *TypeExample) AssignableFrom(other reflect.Type) bool

AssignableFrom returns true if the other type can be assigned to this type example.

func (*TypeExample) Type

func (e *TypeExample) Type() reflect.Type

Type returns the element type of the example (not the pointer type).

Jump to

Keyboard shortcuts

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