gitlab.com/evatix-go/core@v1.3.55/coredata/coredynamic/CastedResult.go (about)

     1  package coredynamic
     2  
     3  import "reflect"
     4  
     5  type CastedResult struct {
     6  	Casted                         interface{}
     7  	SourceReflectType              reflect.Type
     8  	SourceKind                     reflect.Kind
     9  	Error                          error
    10  	IsNull, IsMatchingAcceptedType bool
    11  	IsValid                        bool
    12  	IsPointer                      bool // refers to how returned, ptr or non ptr
    13  	IsSourcePointer                bool
    14  }
    15  
    16  func (it *CastedResult) IsInvalid() bool {
    17  	return it == nil || !it.IsValid
    18  }
    19  
    20  func (it *CastedResult) IsNotNull() bool {
    21  	return it != nil && !it.IsNull
    22  }
    23  
    24  func (it *CastedResult) IsNotPointer() bool {
    25  	return it != nil && !it.IsPointer
    26  }
    27  
    28  func (it *CastedResult) IsNotMatchingAcceptedType() bool {
    29  	return it != nil && !it.IsMatchingAcceptedType
    30  }
    31  
    32  func (it *CastedResult) IsSourceKind(kind reflect.Kind) bool {
    33  	return it != nil && it.SourceKind == kind
    34  }
    35  
    36  func (it *CastedResult) HasError() bool {
    37  	return it != nil && it.Error != nil
    38  }
    39  
    40  func (it *CastedResult) HasAnyIssues() bool {
    41  	return it.IsInvalid() || it.IsNull || !it.IsMatchingAcceptedType
    42  }