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

     1  package coredynamic
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  type DynamicStatus struct {
     6  	Dynamic
     7  	Index   int
     8  	Message string
     9  }
    10  
    11  func InvalidDynamicStatusNoMessage() *DynamicStatus {
    12  	return InvalidDynamicStatus(constants.EmptyString)
    13  }
    14  
    15  func InvalidDynamicStatus(message string) *DynamicStatus {
    16  	return &DynamicStatus{
    17  		Dynamic: NewDynamic(nil, false),
    18  		Index:   constants.InvalidNotFoundCase,
    19  		Message: message,
    20  	}
    21  }
    22  
    23  // Clone Warning: Cannot clone dynamic data or interface properly but set it again
    24  //
    25  // If it is a pointer one needs to copy it manually.
    26  func (it DynamicStatus) Clone() DynamicStatus {
    27  	return DynamicStatus{
    28  		Dynamic: it.Dynamic.Clone(),
    29  		Index:   constants.InvalidNotFoundCase,
    30  		Message: it.Message,
    31  	}
    32  }
    33  
    34  func (it *DynamicStatus) ClonePtr() *DynamicStatus {
    35  	if it == nil {
    36  		return nil
    37  	}
    38  
    39  	return &DynamicStatus{
    40  		Dynamic: it.Dynamic.Clone(),
    41  		Index:   constants.InvalidNotFoundCase,
    42  		Message: it.Message,
    43  	}
    44  }