typeutil

package
v1.2.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReasonTypeKinds                       = fmt.Errorf("type kinds")                        // nolint
	ReasonCodecMarshalerImplementations   = fmt.Errorf("codec marshaler implementations")   // nolint
	ReasonCodecUnmarshalerImplementations = fmt.Errorf("codec unmarshaler implementations") // nolint
	ReasonArrayLength                     = fmt.Errorf("array length")                      // nolint
	ReasonArrayElement                    = fmt.Errorf("array element")                     // nolint
	ReasonMapKey                          = fmt.Errorf("map key")                           // nolint
	ReasonMapValue                        = fmt.Errorf("map value")                         // nolint
	ReasonPtrElememnt                     = fmt.Errorf("pointed type")                      // nolint
	ReasonSliceElement                    = fmt.Errorf("slice element")                     // nolint
	ReasonStructField                     = fmt.Errorf("struct field")                      // nolint
	ReasonInterfaceMethod                 = fmt.Errorf("interface method")                  // nolint
	ReasonChanDir                         = fmt.Errorf("channel direction")                 // nolint
	ReasonChanElement                     = fmt.Errorf("channel element")                   // nolint
	ReasonFuncInNum                       = fmt.Errorf("func in num")                       // nolint
	ReasonFuncOutNum                      = fmt.Errorf("func out num")                      // nolint
	ReasonFuncInType                      = fmt.Errorf("func in type")                      // nolint
	ReasonFuncOutType                     = fmt.Errorf("func out type")                     // nolint
	ReasonExportedFieldsCount             = fmt.Errorf("exported fields count")             // nolint
	ReasonExportedFieldName               = fmt.Errorf("exported field name")               // nolint
	ReasonExportedFieldTag                = fmt.Errorf("exported field tag")                // nolint
	ReasonExportedFieldNotFound           = fmt.Errorf("exported field not found")          // nolint
	ReasonExportedFieldType               = fmt.Errorf("exported field type")               // nolint
	ReasonExportedMethodsCount            = fmt.Errorf("exported methods count")            // nolint
	ReasonExportedMethodName              = fmt.Errorf("exported method name")              // nolint
	ReasonExportedMethodType              = fmt.Errorf("exported method type")              // nolint
	ReasonRecursiveCompare                = fmt.Errorf("recursive compare")                 // nolint
)

Functions

func AllMethods

func AllMethods(obj interface{}) []reflect.Method

func ExportedFields

func ExportedFields(obj interface{}) []reflect.StructField

func ExportedMethods

func ExportedMethods(obj interface{}) []reflect.Method

Types

type CodecFlag

type CodecFlag uint
const (
	CodecBinary CodecFlag = 1 << iota
	CodecText
	CodecJSON
	CodecCbor
)

func (CodecFlag) String

func (i CodecFlag) String() string

type Reason

type Reason struct {
	TypeA  reflect.Type
	TypeB  reflect.Type
	Base   error
	Nested *Reason
}

func Similar

func Similar(a, b interface{}, codecFlag CodecFlag, smode SimilarMode, stack ...SimilarStack) (bool, *Reason)

func (*Reason) Error

func (r *Reason) Error() string

func (*Reason) Is

func (r *Reason) Is(target error) bool

func (*Reason) Unwrap

func (r *Reason) Unwrap() error

type SimilarMode

type SimilarMode uint
const (
	StructFieldsOrdered SimilarMode = 1 << iota
	StructFieldTagsMatch
	InterfaceAllMethods
	AvoidRecursive
)

type SimilarStack

type SimilarStack = [2]reflect.Type

Jump to

Keyboard shortcuts

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