Documentation
¶
Index ¶
- func IsBeanInjectionTarget(t reflect.Type) bool
- func IsBeanType(t reflect.Type) bool
- func IsConstructor(t reflect.Type) bool
- func IsErrorType(t reflect.Type) bool
- func IsFuncType(t reflect.Type) bool
- func IsPrimitiveValueType(t reflect.Type) bool
- func IsPropBindingTarget(t reflect.Type) bool
- func ReturnNothing(t reflect.Type) bool
- func ReturnOnlyError(t reflect.Type) bool
- type FloatType
- type IntType
- type UintType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBeanInjectionTarget ¶
IsBeanInjectionTarget reports whether the provided reflect.Type is a valid target for bean injection.
Valid targets include:
- a bean type itself
- collections (map, slice, array) whose element type is a bean
func IsBeanType ¶
IsBeanType reports whether the provided reflect.Type is considered a "bean" type.
A "bean" type is defined as:
- a channel type
- a function type
- an interface type
- a pointer to a struct type
func IsConstructor ¶
IsConstructor reports whether the provided function type is considered a constructor by convention.
A constructor is defined as a function that returns:
- one non-error value, or
- two values where the second value is an error.
Examples of valid constructor signatures:
func() *MyStruct func(cfg Config) (*MyStruct, error)
Examples of invalid constructor signatures:
func() // returns nothing func() error // returns only an error func() (*A, *B, error) // returns more than two values
func IsErrorType ¶
IsErrorType reports whether the provided reflect.Type represents the built-in error type or a type that implements the error interface.
func IsFuncType ¶
IsFuncType reports whether the provided reflect.Type represents a function.
func IsPrimitiveValueType ¶
IsPrimitiveValueType reports whether the provided reflect.Type represents a primitive value type such as an integer, unsigned integer, float, string, or boolean.
func IsPropBindingTarget ¶
IsPropBindingTarget reports whether the provided reflect.Type is a valid target for property binding.
Valid types include:
- primitive value types
- struct types
- collections (map, slice, array) whose element type is a primitive value or a struct
func ReturnNothing ¶
ReturnNothing reports whether the provided function type returns no values. It is useful when analyzing function signatures using reflection.
func ReturnOnlyError ¶
ReturnOnlyError reports whether the provided function type returns exactly one value and that value is an error.
Types ¶
type FloatType ¶
FloatType is a generic constraint that represents floating-point types: float32 and float64.