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

     1  package chmodhelper
     2  
     3  // AttrVariant
     4  //
     5  // 1 - Execute true
     6  // 2 - Write true
     7  // 3 - Write + Execute true
     8  // 4 - Read true
     9  // 5 - Read + Execute true
    10  // 6 - Read + Write true
    11  // 7 - Read + Write + Execute all true
    12  type AttrVariant byte
    13  
    14  //goland:noinspection ALL
    15  const (
    16  	Execute          AttrVariant = 1
    17  	Write            AttrVariant = 2
    18  	WriteExecute     AttrVariant = 3
    19  	Read             AttrVariant = 4
    20  	ReadExecute      AttrVariant = 5
    21  	ReadWrite        AttrVariant = 6
    22  	ReadWriteExecute AttrVariant = 7
    23  )
    24  
    25  // IsGreaterThan v > byte(attrVariant)
    26  func (attrVariant AttrVariant) IsGreaterThan(v byte) bool {
    27  	return v > byte(attrVariant)
    28  }
    29  
    30  func (attrVariant AttrVariant) String() string {
    31  	return string(attrVariant)
    32  }
    33  
    34  func (attrVariant AttrVariant) Value() byte {
    35  	return byte(attrVariant)
    36  }
    37  
    38  func (attrVariant AttrVariant) ToAttribute() Attribute {
    39  	return New.Attribute.UsingVariantMust(attrVariant)
    40  }