Documentation ¶
Overview ¶
Package gosum provides utilities for Sum/Union/Variant like types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInternalInterface ¶
IsInternalInterface returns true if the given interface has unexported method.
Types ¶
type SumInterface ¶
type SumInterface struct { // underling interface type. It uses types.Named instead of types.Interface // for convenience. NamedInterface *types.Named // is "internal interface" which includes unexported methods, otherwise // "public" interface. IsInternal bool // Implements holds types which implement SumInterface type. Implements struct { Interfaces []*SumInterface Pointers []*types.Pointer } // "Implements" only holds types in PkgScope. It's especially for "public" // interface. PkgScope []*types.Package }
SumInterface represents Sum type by interface{} type.
func NewSumInterface ¶
func NewSumInterface(namedInterface *types.Named, pkgscope []*types.Package) *SumInterface
NewSumInterface returns SumInterface from given interface type. If the given interface is "public", this function searches implemented types in pkgscope. pkgscope can be nil and it's useful to pass nil if you know the interface is "internal" interface.
Click to show internal directories.
Click to hide internal directories.