gitlab.com/evatix-go/core@v1.3.55/converters/coreconverted/Bytes.go (about)

     1  package coreconverted
     2  
     3  type Bytes struct {
     4  	Values        []byte
     5  	CombinedError error
     6  }
     7  
     8  func (it *Bytes) HasError() bool {
     9  	return it.CombinedError != nil
    10  }
    11  
    12  func (it *Bytes) Length() int {
    13  	if it == nil || it.Values == nil {
    14  		return 0
    15  	}
    16  
    17  	return len(it.Values)
    18  }
    19  
    20  func (it *Bytes) HasAnyItem() bool {
    21  	return it.Length() > 0
    22  }
    23  
    24  func (it *Bytes) HasIssuesOrEmpty() bool {
    25  	return it.IsEmpty() || it.CombinedError != nil
    26  }
    27  
    28  func (it *Bytes) IsEmpty() bool {
    29  	return it.Length() == 0
    30  }
    31  
    32  func (it *Bytes) HandleWithPanic() {
    33  	if it.CombinedError == nil {
    34  		return
    35  	}
    36  
    37  	panic(it.CombinedError)
    38  }