Documentation
¶
Index ¶
- Variables
- func Error(fileline string, text string) error
- func Errorf(fileline string, format string, a ...interface{}) error
- func FileLine(fn interface{}) (file string, line int, fnName string)
- func FlattenMap(m map[string]interface{}) map[string]string
- func FlattenValue(key string, val interface{}, result map[string]string)
- func HasReceiver(t reflect.Type, receiver reflect.Value) bool
- func Indirect(t reflect.Type) reflect.Type
- func IsBeanReceiver(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 IsStructPtr(t reflect.Type) bool
- func IsValueType(t reflect.Type) bool
- func PatchValue(v reflect.Value) reflect.Value
- func ReturnNothing(t reflect.Type) bool
- func ReturnOnlyError(t reflect.Type) bool
- func TypeName(i interface{}) string
- func Wrap(err error, fileline string, text string) error
- func Wrapf(err error, fileline string, format string, a ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ForbiddenMethod = errors.New("forbidden method")
ForbiddenMethod throws this error when calling a method is prohibited.
var UnimplementedMethod = errors.New("unimplemented method")
UnimplementedMethod throws this error when calling an unimplemented method.
Functions ¶
func Error ¶
Error returns an error with the file and line. The file and line may be calculated at the compile time in the future.
func Errorf ¶
Errorf returns an error with the file and line. The file and line may be calculated at the compile time in the future.
func FlattenMap ¶
FlattenMap can expand the nested array, slice and map.
func FlattenValue ¶
FlattenValue can expand the nested array, slice and map.
func HasReceiver ¶
HasReceiver returns whether the function has a receiver.
func IsBeanReceiver ¶
IsBeanReceiver returns whether the `t` is a bean receiver, a bean receiver can be a bean, a map or slice whose elements are beans.
func IsBeanType ¶
IsBeanType returns whether `t` is a bean type.
func IsConstructor ¶
IsConstructor returns whether `t` is a constructor type. What is a constructor? It should be a function first, has any number of inputs and supports the option pattern input, has one or two outputs and the second output should be an error.
func IsErrorType ¶
IsErrorType returns whether `t` is error type.
func IsPrimitiveValueType ¶
IsPrimitiveValueType returns whether `t` is the primitive value type which only is int, unit, float, bool, string and complex.
func IsStructPtr ¶
IsStructPtr returns whether it is the pointer type of structure.
func IsValueType ¶
IsValueType returns whether the input type is the primitive value type and their composite type including array, slice, map and struct, such as []int, [3]string, []string, map[int]int, map[string]string, etc.
func PatchValue ¶
PatchValue makes an unexported field can be assignable.
func ReturnNothing ¶
ReturnNothing returns whether the function has no return value.
func ReturnOnlyError ¶
ReturnOnlyError returns whether the function returns only error value.
func TypeName ¶
func TypeName(i interface{}) string
TypeName returns a fully qualified name consisting of package path and type name.
Types ¶
This section is empty.