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 ¶
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).
Click to show internal directories.
Click to hide internal directories.