gitlab.com/evatix-go/core@v1.3.55/chmodhelper/chmodins/ParseBaseRwxInstructionsUsingJsonResult.go (about)

     1  package chmodins
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/coredata/corejson"
     5  	"gitlab.com/evatix-go/core/errcore"
     6  )
     7  
     8  func ParseBaseRwxInstructionsUsingJsonResult(
     9  	result *corejson.Result,
    10  ) (*BaseRwxInstructions, error) {
    11  	if result == nil {
    12  		return nil,
    13  			errcore.BytesAreNilOrEmptyType.Error(
    14  				"ParseBaseRwxInstructionsUsingJsonResult", nil)
    15  	}
    16  
    17  	if result.IsEmptyJsonBytes() || result.HasError() {
    18  		return nil, result.MeaningfulError()
    19  	}
    20  
    21  	var baseRwxInstructions BaseRwxInstructions
    22  	err := result.Unmarshal(&baseRwxInstructions)
    23  
    24  	if err != nil {
    25  		return nil, errcore.MeaningfulError(
    26  			errcore.FailedToParseType,
    27  			"ParseBaseRwxInstructionsUsingJsonResult",
    28  			err)
    29  	}
    30  
    31  	return &baseRwxInstructions, nil
    32  }