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

     1  package chmodins
     2  
     3  type BaseRwxInstructions struct {
     4  	RwxInstructions []RwxInstruction `json:"RwxInstructions,omitempty"`
     5  }
     6  
     7  func (it *BaseRwxInstructions) Length() int {
     8  	if it == nil || it.RwxInstructions == nil {
     9  		return 0
    10  	}
    11  
    12  	return len(it.RwxInstructions)
    13  }
    14  
    15  func (it *BaseRwxInstructions) IsEmpty() bool {
    16  	return it.Length() == 0
    17  }
    18  
    19  func (it *BaseRwxInstructions) HasAnyItem() bool {
    20  	return it.Length() > 0
    21  }
    22  
    23  func (it *BaseRwxInstructions) Clone() *BaseRwxInstructions {
    24  	if it == nil {
    25  		return nil
    26  	}
    27  
    28  	cloned := it.CloneNonPtr()
    29  
    30  	return &cloned
    31  }
    32  
    33  func (it BaseRwxInstructions) CloneNonPtr() BaseRwxInstructions {
    34  	instructions := make(
    35  		[]RwxInstruction,
    36  		it.Length())
    37  
    38  	for i, instruction := range it.RwxInstructions {
    39  		instructions[i] = *instruction.Clone()
    40  	}
    41  
    42  	return BaseRwxInstructions{
    43  		RwxInstructions: instructions,
    44  	}
    45  }