chmodhelper

package
v1.3.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 28 Imported by: 17

Documentation

Index

Constants

View Source
const (
	SingleRwxLengthString                 = "3"
	HyphenedRwxLength                     = constants.ArbitraryCapacity10
	HyphenedRwxLengthString               = constants.N10String
	FullRwxLengthWithoutHyphenString      = constants.N9String
	FullRwxLengthWithoutHyphen            = constants.ArbitraryCapacity9
	SingleRwxLength                       = 3
	ReadValue                             = 4
	WriteValue                            = 2
	ExecuteValue                          = 1
	ReadWriteValue                        = ReadValue + WriteValue
	ReadExecuteValue                      = ReadValue + ExecuteValue
	WriteExecuteValue                     = WriteValue + ExecuteValue
	ReadWriteExecuteValue                 = ReadValue + WriteValue + ExecuteValue
	OwnerIndex                            = 0
	GroupIndex                            = 1
	OtherIndex                            = 2
	ReadChar                         byte = 'r'
	NopChar                          byte = '-'
	WriteChar                        byte = 'w'
	ExecuteChar                      byte = 'x'
	AllWildcards                          = "***"
)

Reference : https://ss64.com/bash/chmod.html

Variables

View Source
var (
	SimpleFileWriter = simpleFileWriter{}
	New              = newCreator{}
	ChmodApply       = chmodApplier{}
	ChmodVerify      = chmodVerifier{}
)

Functions

func CreateDirFilesWithRwxPermission added in v0.6.9

func CreateDirFilesWithRwxPermission(
	isRemoveAllDirBeforeCreate bool,
	dirFilesWithRwxPermission *DirFilesWithRwxPermission,
) error

func CreateDirFilesWithRwxPermissions added in v0.6.9

func CreateDirFilesWithRwxPermissions(
	isRemoveAllDirBeforeCreate bool,
	dirFilesWithRwxPermissions *[]*DirFilesWithRwxPermission,
) error

func CreateDirFilesWithRwxPermissionsMust added in v0.6.9

func CreateDirFilesWithRwxPermissionsMust(
	isRemoveAllDirBeforeCreate bool,
	dirFilesWithRwxPermissions *[]*DirFilesWithRwxPermission,
)

func CreateDirWithFiles added in v0.6.9

func CreateDirWithFiles(
	isRemoveAllDirBeforeCreate bool,
	fileChmod os.FileMode,
	dirWithFile *DirWithFiles,
) error

func CreateDirsWithFiles added in v0.6.9

func CreateDirsWithFiles(
	isRemoveAllDirBeforeCreate bool,
	fileChmod os.FileMode,
	dirsWithFiles ...DirWithFiles,
) error

func ExpandCharRwx added in v0.5.4

func ExpandCharRwx(rwx string) (r, w, x byte)

ExpandCharRwx Expands to 'r', 'w', 'x'

func FileModeFriendlyString added in v1.3.16

func FileModeFriendlyString(
	fileMode os.FileMode,
) string

func GetExistingChmod

func GetExistingChmod(filePath string) (os.FileMode, error)

func GetExistingChmodRwxWrappers added in v0.6.2

func GetExistingChmodRwxWrappers(
	isContinueOnError bool,
	locations ...string,
) (filePathToRwxWrapper map[string]*RwxWrapper, err error)

func GetFilesChmodRwxFullMap added in v0.5.5

func GetFilesChmodRwxFullMap(
	requestedPaths []string,
) (filePathToRwxMap *corestr.Hashmap, err error)

GetFilesChmodRwxFullMap returns filePath -> "-rwxrwxrwx"

func GetFilesChmodRwxFullMapDirect added in v0.5.5

func GetFilesChmodRwxFullMapDirect(
	requestedPaths ...string,
) (*corestr.Hashmap, error)

GetFilesChmodRwxFullMapDirect returns filePath -> "-rwxrwxrwx"

func GetFilteredExistsFilesInfosOnly added in v0.6.2

func GetFilteredExistsFilesInfosOnly(
	locations ...string,
) map[string]os.FileInfo

GetFilteredExistsFilesInfosOnly

Warning: File related errors will be swallowed

func GetFilteredExistsPaths added in v0.6.2

func GetFilteredExistsPaths(locations []string) (
	foundFiles, missingOrPathsWithIssues []string,
)

func GetPathExistStatExpand added in v0.6.9

func GetPathExistStatExpand(location string) (fileInfo os.FileInfo, isExist bool, err error)

func GetRecursivePaths added in v0.8.0

func GetRecursivePaths(
	isContinueOnError bool,
	rootPath string,
) ([]string, error)

func GetRecursivePathsContinueOnError added in v0.8.1

func GetRecursivePathsContinueOnError(
	rootPath string,
) ([]string, error)

func GetRwxLengthError added in v0.4.1

func GetRwxLengthError(rwx string) error

func IsChmod added in v0.4.1

func IsChmod(location string, expectedHyphenedRwx string) bool

IsChmod expectedHyphenedRwx should be 10 chars example "-rwxrwxrwx"

func IsChmodEqualUsingRwxOwnerGroupOther added in v0.4.1

func IsChmodEqualUsingRwxOwnerGroupOther(
	location string,
	rwx *chmodins.RwxOwnerGroupOther,
) bool

func IsDirectory added in v0.6.2

func IsDirectory(location string) bool

func IsPartialMatchVariableAttr added in v0.6.2

func IsPartialMatchVariableAttr(
	givenVarAttr *VarAttribute,
	rwx string,
) bool

IsPartialMatchVariableAttr

@givenVarAttr can have wildcards "*"
 On wildcard present comparison will ignore for that segment.

Example (will consider this a match):
 - givenVarAttr: (rwx : "r*x"),
 - rwx         : (rwx : "r-x")

func IsPathExists added in v0.6.2

func IsPathExists(location string) bool

func IsPathExistsPlusFileInfo added in v0.6.2

func IsPathExistsPlusFileInfo(location string) (bool, os.FileInfo)

func ParseRwxInstructionToStringRwx added in v0.4.1

func ParseRwxInstructionToStringRwx(
	rwxInstruction *chmodins.RwxOwnerGroupOther,
	isIncludeHyphen bool,
) string

func ParseRwxOwnerGroupOtherToFileMode added in v0.6.9

func ParseRwxOwnerGroupOtherToFileMode(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
) (os.FileMode, error)

func ParseRwxOwnerGroupOtherToFileModeMust added in v0.6.9

func ParseRwxOwnerGroupOtherToFileModeMust(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
) os.FileMode

func RecursivePathsApply added in v0.8.0

func RecursivePathsApply(
	rootPath string,
	actionFunc func(currentPath string, info fs.FileInfo, err error) error,
) error

func RwxOwnerGroupOtherApplyChmod added in v0.5.6

func RwxOwnerGroupOtherApplyChmod(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
	condition *chmodins.Condition,
	locations ...string,
) error

RwxOwnerGroupOtherApplyChmod rwxFullString 10 chars "-rwxrwxrwx"

func RwxStringApplyChmod added in v0.5.5

func RwxStringApplyChmod(
	rwxFullString string,
	condition *chmodins.Condition,
	locations ...string,
) error

RwxStringApplyChmod

rwxFullString 10 chars "-rwxrwxrwx"

Types

type AttrVariant

type AttrVariant byte

AttrVariant

1 - Execute true 2 - Write true 3 - Write + Execute true 4 - Read true 5 - Read + Execute true 6 - Read + Write true 7 - Read + Write + Execute all true

const (
	Execute          AttrVariant = 1
	Write            AttrVariant = 2
	WriteExecute     AttrVariant = 3
	Read             AttrVariant = 4
	ReadExecute      AttrVariant = 5
	ReadWrite        AttrVariant = 6
	ReadWriteExecute AttrVariant = 7
)

func (AttrVariant) IsGreaterThan

func (attrVariant AttrVariant) IsGreaterThan(v byte) bool

IsGreaterThan v > byte(attrVariant)

func (AttrVariant) String

func (attrVariant AttrVariant) String() string

func (AttrVariant) ToAttribute

func (attrVariant AttrVariant) ToAttribute() Attribute

func (AttrVariant) Value

func (attrVariant AttrVariant) Value() byte

type Attribute

type Attribute struct {
	IsRead    bool
	IsWrite   bool
	IsExecute bool
}

func MergeRwxWildcardWithFixedRwx added in v0.4.1

func MergeRwxWildcardWithFixedRwx(
	existingRwx,
	rwxWildcardInput string,
) (
	fixedAttribute *Attribute,
	err error,
)

MergeRwxWildcardWithFixedRwx

  • existingRwx : Usually refers to fixed rwx values like "rwx", "--x", "-w-" etc.

  • rwxWildcardInput : Usually refers to fixed rwx values like "rw*", "*-x", "-w-" etc. Wildcard means keep the existing value as is.

    Example:

  • existingRwx : (rwx : "r-x"),

  • rwxWildcardInput : (rwx : "r*-")

  • @returns : "r--"

func (*Attribute) Clone added in v0.5.4

func (it *Attribute) Clone() *Attribute

func (*Attribute) HasAnyItem added in v1.3.16

func (it *Attribute) HasAnyItem() bool

func (*Attribute) IsAnyNull added in v1.3.16

func (it *Attribute) IsAnyNull() bool

func (*Attribute) IsDefined added in v1.3.16

func (it *Attribute) IsDefined() bool

func (*Attribute) IsEmpty added in v1.3.16

func (it *Attribute) IsEmpty() bool

func (Attribute) IsEqual added in v0.6.2

func (it Attribute) IsEqual(next Attribute) bool

func (*Attribute) IsEqualPtr added in v0.6.2

func (it *Attribute) IsEqualPtr(next *Attribute) bool

func (*Attribute) IsInvalid added in v1.3.16

func (it *Attribute) IsInvalid() bool

func (*Attribute) IsNull added in v1.3.16

func (it *Attribute) IsNull() bool

func (*Attribute) IsZero added in v1.3.16

func (it *Attribute) IsZero() bool

func (*Attribute) ToAttributeValue

func (it *Attribute) ToAttributeValue() AttributeValue

func (*Attribute) ToByte

func (it *Attribute) ToByte() byte

ToByte refers to the compiled byte value in between 0-7

func (*Attribute) ToRwx

func (it *Attribute) ToRwx() [3]byte

func (*Attribute) ToRwxString

func (it *Attribute) ToRwxString() string

ToRwxString returns "rwx"

func (*Attribute) ToSpecificBytes

func (it *Attribute) ToSpecificBytes() (read, write, exe, sum byte)

func (*Attribute) ToStringByte added in v0.4.4

func (it *Attribute) ToStringByte() byte

ToStringByte returns the compiled byte value as Char byte value

It is not restricted between 0-7 but 0-7 + char '0', which makes it string 0-7

func (*Attribute) ToSum

func (it *Attribute) ToSum() byte

ToSum refers to the compiled byte value in between 0-7

func (*Attribute) ToVariant

func (it *Attribute) ToVariant() AttrVariant

type AttributeValue

type AttributeValue struct {
	Read, Write, Execute, Sum byte
}

type DirFilesWithRwxPermission added in v0.6.9

type DirFilesWithRwxPermission struct {
	DirWithFiles
	ApplyRwx chmodins.RwxOwnerGroupOther
}

func (*DirFilesWithRwxPermission) CreatePaths added in v0.6.9

func (it *DirFilesWithRwxPermission) CreatePaths(
	isRemoveBeforeCreate bool,
) error

func (*DirFilesWithRwxPermission) CreatePathsUsingFileMode added in v0.6.9

func (it *DirFilesWithRwxPermission) CreatePathsUsingFileMode(
	isRemoveBeforeCreate bool,
	fileMode os.FileMode,
) error

func (*DirFilesWithRwxPermission) GetFilesChmodMap added in v0.6.9

func (it *DirFilesWithRwxPermission) GetFilesChmodMap() *corestr.Hashmap

func (*DirFilesWithRwxPermission) GetPaths added in v0.6.9

func (it *DirFilesWithRwxPermission) GetPaths() []string

func (*DirFilesWithRwxPermission) GetPathsPtr added in v0.6.9

func (it *DirFilesWithRwxPermission) GetPathsPtr() *[]string

type DirWithFiles added in v0.6.9

type DirWithFiles struct {
	Dir   string
	Files []string
}

func (*DirWithFiles) CreatePaths added in v0.6.9

func (it *DirWithFiles) CreatePaths(
	isRemoveBeforeCreate bool,
	fileMode os.FileMode,
) error

type FilteredPathFileInfoMap added in v0.6.2

type FilteredPathFileInfoMap struct {
	FilesToInfoMap           map[string]os.FileInfo
	PathsRemainsUnProcessed  []string // TODO
	MissingOrOtherPathIssues []string
	Error                    error
	// contains filtered or unexported fields
}

func GetExistsFilteredPathFileInfoMap added in v0.6.2

func GetExistsFilteredPathFileInfoMap(
	isSkipOnInvalid bool,
	locations ...string,
) *FilteredPathFileInfoMap

func InvalidFilteredPathFileInfoMap added in v0.6.2

func InvalidFilteredPathFileInfoMap() *FilteredPathFileInfoMap

func (*FilteredPathFileInfoMap) HasAnyIssues added in v0.6.2

func (it *FilteredPathFileInfoMap) HasAnyIssues() bool

func (*FilteredPathFileInfoMap) HasAnyMissingPaths added in v0.6.2

func (it *FilteredPathFileInfoMap) HasAnyMissingPaths() bool

func (*FilteredPathFileInfoMap) HasAnyValidFileInfo added in v0.6.2

func (it *FilteredPathFileInfoMap) HasAnyValidFileInfo() bool

func (*FilteredPathFileInfoMap) HasError added in v0.6.3

func (it *FilteredPathFileInfoMap) HasError() bool

func (*FilteredPathFileInfoMap) IsEmptyIssues added in v0.6.2

func (it *FilteredPathFileInfoMap) IsEmptyIssues() bool

func (*FilteredPathFileInfoMap) IsEmptyValidFileInfos added in v0.6.2

func (it *FilteredPathFileInfoMap) IsEmptyValidFileInfos() bool

func (*FilteredPathFileInfoMap) LazyValidLocationFileInfoRwxWrappers added in v0.6.3

func (it *FilteredPathFileInfoMap) LazyValidLocationFileInfoRwxWrappers() []LocationFileInfoRwxWrapper

func (*FilteredPathFileInfoMap) LazyValidLocations added in v0.6.3

func (it *FilteredPathFileInfoMap) LazyValidLocations() []string

func (*FilteredPathFileInfoMap) LengthOfIssues added in v0.6.2

func (it *FilteredPathFileInfoMap) LengthOfIssues() int

func (*FilteredPathFileInfoMap) MissingPathsToString added in v0.6.2

func (it *FilteredPathFileInfoMap) MissingPathsToString() string

func (*FilteredPathFileInfoMap) ValidFileInfos added in v0.6.3

func (it *FilteredPathFileInfoMap) ValidFileInfos() []os.FileInfo

func (*FilteredPathFileInfoMap) ValidLocationFileInfoRwxWrappers added in v0.6.3

func (it *FilteredPathFileInfoMap) ValidLocationFileInfoRwxWrappers() []LocationFileInfoRwxWrapper

func (*FilteredPathFileInfoMap) ValidLocations added in v0.6.3

func (it *FilteredPathFileInfoMap) ValidLocations() []string

type LocationFileInfoRwxWrapper added in v0.6.3

type LocationFileInfoRwxWrapper struct {
	Location   string
	FileInfo   os.FileInfo
	RwxWrapper *RwxWrapper
}

type PathExistStat added in v0.6.9

type PathExistStat struct {
	Location string
	FileInfo os.FileInfo
	IsExist  bool
	Error    error
}

func GetPathExistStat added in v0.6.2

func GetPathExistStat(location string) *PathExistStat

func GetPathExistStats added in v0.9.6

func GetPathExistStats(
	isCollectValidOnly bool,
	locations ...string,
) []*PathExistStat

func (*PathExistStat) CombineWith added in v0.9.5

func (it *PathExistStat) CombineWith(additionalPaths ...string) *PathExistStat

func (*PathExistStat) CombineWithNewPath added in v0.9.5

func (it *PathExistStat) CombineWithNewPath(additionalPaths ...string) string

func (*PathExistStat) Dispose added in v0.9.5

func (it *PathExistStat) Dispose()

func (*PathExistStat) DotExt added in v0.9.5

func (it *PathExistStat) DotExt() (dotExt string)

func (*PathExistStat) FileMode added in v0.9.5

func (it *PathExistStat) FileMode() *os.FileMode

func (*PathExistStat) FileName added in v0.9.5

func (it *PathExistStat) FileName() (filename string)

func (*PathExistStat) HasAnyIssues added in v0.9.5

func (it *PathExistStat) HasAnyIssues() bool

func (*PathExistStat) HasError added in v0.6.9

func (it *PathExistStat) HasError() bool

func (*PathExistStat) HasFileInfo added in v0.6.9

func (it *PathExistStat) HasFileInfo() bool

func (*PathExistStat) IsDir added in v0.6.9

func (it *PathExistStat) IsDir() bool

func (*PathExistStat) IsEmptyError added in v0.6.9

func (it *PathExistStat) IsEmptyError() bool

func (*PathExistStat) IsFile added in v0.6.9

func (it *PathExistStat) IsFile() bool

func (*PathExistStat) IsInvalid added in v0.9.5

func (it *PathExistStat) IsInvalid() bool

func (*PathExistStat) IsInvalidFileInfo added in v0.9.6

func (it *PathExistStat) IsInvalidFileInfo() bool

func (*PathExistStat) LastModifiedDate added in v0.9.5

func (it *PathExistStat) LastModifiedDate() *time.Time

func (*PathExistStat) MeaningFullError added in v0.6.9

func (it *PathExistStat) MeaningFullError() error

func (*PathExistStat) MessageWithPathWrapped added in v0.9.6

func (it *PathExistStat) MessageWithPathWrapped(
	message string,
) string

func (*PathExistStat) NotADirError added in v0.9.6

func (it *PathExistStat) NotADirError() error

NotADirError

Get error on:

  • Path has issues or not exist
  • Expecting dir, if not dir then error

func (*PathExistStat) NotAFileError added in v0.9.6

func (it *PathExistStat) NotAFileError() error

NotAFileError

Get error on:

  • Path has issues or not exist
  • Expecting file, if not file then error

func (*PathExistStat) NotExistError added in v0.9.6

func (it *PathExistStat) NotExistError() error

func (*PathExistStat) Parent added in v0.9.5

func (it *PathExistStat) Parent() *PathExistStat

func (*PathExistStat) ParentDir added in v0.9.5

func (it *PathExistStat) ParentDir() (parentDir string)

func (*PathExistStat) ParentWith added in v0.9.5

func (it *PathExistStat) ParentWith(additionalPaths ...string) *PathExistStat

func (*PathExistStat) ParentWithGlobPatternFiles added in v0.9.5

func (it *PathExistStat) ParentWithGlobPatternFiles(globPatterns ...string) ([]string, error)

func (*PathExistStat) ParentWithNewPath added in v0.9.5

func (it *PathExistStat) ParentWithNewPath(additionalPaths ...string) string

func (*PathExistStat) Size added in v0.9.5

func (it *PathExistStat) Size() *int64

func (*PathExistStat) Split added in v0.9.5

func (it *PathExistStat) Split() (dir, filename string)

func (*PathExistStat) String added in v0.9.6

func (it *PathExistStat) String() string

type RwxInstructionExecutor added in v0.4.1

type RwxInstructionExecutor struct {
	// contains filtered or unexported fields
}

func ParseRwxInstructionToExecutor added in v0.4.1

func ParseRwxInstructionToExecutor(
	rwxInstruction *chmodins.RwxInstruction,
) (
	*RwxInstructionExecutor, error,
)

func RwxPartialToInstructionExecutor added in v0.6.2

func RwxPartialToInstructionExecutor(
	rwxPartial string,
	condition *chmodins.Condition,
) (*RwxInstructionExecutor, error)

RwxPartialToInstructionExecutor

rwxPartial can be any length in between 0-10 (rest will be fixed by wildcard)

rwxPartial:

  • "-rwx" will be "-rwx******"
  • "-rwxr-x" will be "-rwxr-x***"
  • "-rwxr-x" will be "-rwxr-x***"

func (*RwxInstructionExecutor) ApplyOnPath added in v0.4.1

func (it *RwxInstructionExecutor) ApplyOnPath(location string) error

func (*RwxInstructionExecutor) ApplyOnPaths added in v0.4.1

func (it *RwxInstructionExecutor) ApplyOnPaths(locations []string) error

func (*RwxInstructionExecutor) ApplyOnPathsDirect added in v0.5.5

func (it *RwxInstructionExecutor) ApplyOnPathsDirect(locations ...string) error

func (*RwxInstructionExecutor) ApplyOnPathsPtr added in v0.5.4

func (it *RwxInstructionExecutor) ApplyOnPathsPtr(locations *[]string) error

func (*RwxInstructionExecutor) CompiledRwxWrapperUsingFixedRwxWrapper added in v0.5.0

func (it *RwxInstructionExecutor) CompiledRwxWrapperUsingFixedRwxWrapper(
	wrapper *RwxWrapper,
) (*RwxWrapper, error)

func (*RwxInstructionExecutor) CompiledWrapper added in v0.4.1

func (it *RwxInstructionExecutor) CompiledWrapper(mode os.FileMode) (*RwxWrapper, error)

func (*RwxInstructionExecutor) IsEqualFileInfo added in v0.6.2

func (it *RwxInstructionExecutor) IsEqualFileInfo(fileInfo os.FileInfo) bool

IsEqualFileInfo fileInfo nil returns false.

func (*RwxInstructionExecutor) IsEqualFileMode added in v0.6.2

func (it *RwxInstructionExecutor) IsEqualFileMode(mode os.FileMode) bool

func (*RwxInstructionExecutor) IsEqualRwxPartial added in v0.6.2

func (it *RwxInstructionExecutor) IsEqualRwxPartial(rwxPartial string) bool

IsEqualRwxPartial

rwxPartial:

  • "-rwx" will be "-rwx******"
  • "-rwxr-x" will be "-rwxr-x***"
  • "-rwxr-x" will be "-rwxr-x***"

func (*RwxInstructionExecutor) IsEqualRwxWrapper added in v0.6.2

func (it *RwxInstructionExecutor) IsEqualRwxWrapper(rwxWrapper *RwxWrapper) bool

IsEqualRwxWrapper nil returns false.

func (*RwxInstructionExecutor) IsFixedWrapper added in v0.4.1

func (it *RwxInstructionExecutor) IsFixedWrapper() bool

IsFixedWrapper true indicates no wildcard symbol

func (*RwxInstructionExecutor) IsVarWrapper added in v0.4.1

func (it *RwxInstructionExecutor) IsVarWrapper() bool

IsVarWrapper if it has any wildcard symbol in it

func (*RwxInstructionExecutor) VerifyRwxModifiers added in v0.6.2

func (it *RwxInstructionExecutor) VerifyRwxModifiers(
	isRecursiveIgnore bool,
	locations []string,
) error

func (*RwxInstructionExecutor) VerifyRwxModifiersDirect added in v0.6.2

func (it *RwxInstructionExecutor) VerifyRwxModifiersDirect(
	isRecursiveIgnore bool,
	locations ...string,
) error

type RwxInstructionExecutors added in v0.4.1

type RwxInstructionExecutors struct {
	// contains filtered or unexported fields
}

func NewRwxInstructionExecutors added in v0.4.1

func NewRwxInstructionExecutors(capacity int) *RwxInstructionExecutors

func ParseBaseRwxInstructionsToExecutors added in v0.4.1

func ParseBaseRwxInstructionsToExecutors(
	baseRwxInstructions *chmodins.BaseRwxInstructions,
) (
	*RwxInstructionExecutors, error,
)

func ParseRwxInstructionsToExecutors added in v0.4.1

func ParseRwxInstructionsToExecutors(
	rwxInstructions []chmodins.RwxInstruction,
) (
	*RwxInstructionExecutors, error,
)

func (*RwxInstructionExecutors) Add added in v0.4.1

func (it *RwxInstructionExecutors) Add(
	rwxInstructionExecutor *RwxInstructionExecutor,
) *RwxInstructionExecutors

Add skips nil

func (*RwxInstructionExecutors) Adds added in v0.4.1

func (it *RwxInstructionExecutors) Adds(
	rwxInstructionExecutors ...*RwxInstructionExecutor,
) *RwxInstructionExecutors

Adds skips nil

func (*RwxInstructionExecutors) ApplyOnPath added in v0.4.1

func (it *RwxInstructionExecutors) ApplyOnPath(location string) error

func (*RwxInstructionExecutors) ApplyOnPaths added in v0.4.1

func (it *RwxInstructionExecutors) ApplyOnPaths(locations []string) error

func (*RwxInstructionExecutors) ApplyOnPathsPtr added in v0.5.4

func (it *RwxInstructionExecutors) ApplyOnPathsPtr(locations *[]string) error

func (*RwxInstructionExecutors) Count added in v0.4.1

func (it *RwxInstructionExecutors) Count() int

func (*RwxInstructionExecutors) HasAnyItem added in v0.4.1

func (it *RwxInstructionExecutors) HasAnyItem() bool

func (*RwxInstructionExecutors) HasIndex added in v0.4.1

func (it *RwxInstructionExecutors) HasIndex(index int) bool

func (*RwxInstructionExecutors) IsEmpty added in v0.4.1

func (it *RwxInstructionExecutors) IsEmpty() bool

func (*RwxInstructionExecutors) Items added in v0.4.1

func (*RwxInstructionExecutors) LastIndex added in v0.4.1

func (it *RwxInstructionExecutors) LastIndex() int

func (*RwxInstructionExecutors) Length added in v0.4.1

func (it *RwxInstructionExecutors) Length() int

func (*RwxInstructionExecutors) VerifyRwxModifiers added in v0.6.2

func (it *RwxInstructionExecutors) VerifyRwxModifiers(
	isContinueOnErr,
	isRecursiveIgnore bool,
	locations []string,
) error

type RwxMatchingStatus added in v0.6.2

type RwxMatchingStatus struct {
	RwxMismatchInfos         []*RwxMismatchInfo
	MissingOrPathsWithIssues []string
	IsAllMatching            bool
	Error                    error
}

func EmptyRwxMatchingStatus added in v0.6.2

func EmptyRwxMatchingStatus() *RwxMatchingStatus

func InvalidRwxMatchingStatus added in v0.6.2

func InvalidRwxMatchingStatus(err error) *RwxMatchingStatus

func (*RwxMatchingStatus) CreateErrFinalError added in v0.6.2

func (it *RwxMatchingStatus) CreateErrFinalError() error

func (*RwxMatchingStatus) MissingFilesToString added in v0.6.2

func (it *RwxMatchingStatus) MissingFilesToString() string

type RwxMismatchInfo added in v0.6.2

type RwxMismatchInfo struct {
	FilePath          string
	Expecting, Actual string
}

type RwxVariableWrapper added in v0.4.4

type RwxVariableWrapper struct {
	Owner, Group, Other VarAttribute
	// contains filtered or unexported fields
}

func NewRwxVariableWrapper added in v0.6.2

func NewRwxVariableWrapper(partialRwx string) (*RwxVariableWrapper, error)

NewRwxVariableWrapper

partialRwx can be any length in
between 1-10 (rest will be fixed by wildcard)

Hyphened prefix MUST.

rwxPartial:

  • "-rwx" will be "-rwx******"
  • "-rwxr-x" will be "-rwxr-x***"
  • "-rwxr-x" will be "-rwxr-x***"

Restrictions:

  • cannot have first char other than hyphen(-) or else things will not work

func ParseRwxInstructionToVarWrapper added in v0.4.1

func ParseRwxInstructionToVarWrapper(
	rwxInstruction *chmodins.RwxInstruction,
) (
	*RwxVariableWrapper, error,
)

func ParseRwxOwnerGroupOtherToRwxVariableWrapper added in v0.4.4

func ParseRwxOwnerGroupOtherToRwxVariableWrapper(
	rwxOwnerGroupOther *chmodins.RwxOwnerGroupOther,
) (
	*RwxVariableWrapper, error,
)

func (*RwxVariableWrapper) ApplyRwxOnLocations added in v0.6.3

func (varWrapper *RwxVariableWrapper) ApplyRwxOnLocations(
	isContinueOnError,
	isSkipOnInvalid bool,
	locations ...string,
) error

func (*RwxVariableWrapper) Clone added in v0.5.4

func (varWrapper *RwxVariableWrapper) Clone() *RwxVariableWrapper

func (*RwxVariableWrapper) HasWildcard added in v0.6.2

func (varWrapper *RwxVariableWrapper) HasWildcard() bool

func (*RwxVariableWrapper) IsEqualPartialFullRwx added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualPartialFullRwx(
	fullRwx string,
) bool

IsEqualPartialFullRwx will compare with concrete FullRwx (10 chars) where wildcard will be ignore during compare

func (*RwxVariableWrapper) IsEqualPartialRwxPartial added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualPartialRwxPartial(
	rwxPartial string,
) bool

IsEqualPartialRwxPartial

will make the partial to full rwx and then calls IsEqualPartialFullRwx
partialRwx can be any length in
between 1-10 (rest will be fixed by wildcard)

rwxPartial:

  • "-rwx" will be "-rwx******"
  • "-rwxr-x" will be "-rwxr-x***"
  • "-rwxr-x" will be "-rwxr-x***"

func (*RwxVariableWrapper) IsEqualPartialUsingFileMode added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualPartialUsingFileMode(
	mode os.FileMode,
) bool

IsEqualPartialUsingFileMode will compare with concrete FullRwx (10 chars) where wildcard will be ignore during compare

func (*RwxVariableWrapper) IsEqualPtr added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualPtr(next *RwxVariableWrapper) bool

func (*RwxVariableWrapper) IsEqualRwxWrapperPtr added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualRwxWrapperPtr(
	rwxWrapper *RwxWrapper,
) bool

IsEqualRwxWrapperPtr returns by sending to IsEqualPartialFullRwx

Returns false on nil.

func (*RwxVariableWrapper) IsEqualUsingFileInfo added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualUsingFileInfo(
	fileInfo os.FileInfo,
) bool

IsEqualUsingFileInfo returns by sending to IsEqualPartialFullRwx

Returns false on nil.

func (*RwxVariableWrapper) IsEqualUsingFileMode added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualUsingFileMode(
	fileMode os.FileMode,
) bool

IsEqualUsingFileMode returns by sending to IsEqualPartialFullRwx

Returns false on nil.

func (*RwxVariableWrapper) IsEqualUsingLocation added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsEqualUsingLocation(
	location string,
) bool

IsEqualUsingLocation returns by sending to IsEqualPartialFullRwx

Returns false on non exist.

func (*RwxVariableWrapper) IsFixedType added in v0.4.4

func (varWrapper *RwxVariableWrapper) IsFixedType() bool

func (*RwxVariableWrapper) IsGroupPartialMatch added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsGroupPartialMatch(rwx string) bool

func (*RwxVariableWrapper) IsMismatchPartialFullRwx added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsMismatchPartialFullRwx(
	fullRwx string,
) bool

IsMismatchPartialFullRwx returns revert of IsEqualPartialFullRwx

fullRwx (10 chars) where wildcard will be ignore during compare

func (*RwxVariableWrapper) IsOtherPartialMatch added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsOtherPartialMatch(rwx string) bool

func (*RwxVariableWrapper) IsOwnerPartialMatch added in v0.6.2

func (varWrapper *RwxVariableWrapper) IsOwnerPartialMatch(rwx string) bool

func (*RwxVariableWrapper) RwxMatchingStatus added in v0.6.2

func (varWrapper *RwxVariableWrapper) RwxMatchingStatus(
	isContinueOnError,
	isSkipOnInvalid bool,
	locations []string,
) *RwxMatchingStatus

func (*RwxVariableWrapper) String added in v0.6.2

func (varWrapper *RwxVariableWrapper) String() string

func (*RwxVariableWrapper) ToCompileFixedPtr added in v0.4.4

func (varWrapper *RwxVariableWrapper) ToCompileFixedPtr() *RwxWrapper

func (*RwxVariableWrapper) ToCompileWrapper added in v0.4.4

func (varWrapper *RwxVariableWrapper) ToCompileWrapper(fixed *RwxWrapper) RwxWrapper

ToCompileWrapper if Fixed type then fixed input can be nil.

func (*RwxVariableWrapper) ToCompileWrapperPtr added in v0.4.4

func (varWrapper *RwxVariableWrapper) ToCompileWrapperPtr(fixed *RwxWrapper) *RwxWrapper

ToCompileWrapperPtr if Fixed type then fixed input can be nil.

func (*RwxVariableWrapper) ToCompileWrapperUsingLocationPtr added in v0.5.5

func (varWrapper *RwxVariableWrapper) ToCompileWrapperUsingLocationPtr(location string) (*RwxWrapper, error)

func (*RwxVariableWrapper) ToString added in v0.6.2

func (varWrapper *RwxVariableWrapper) ToString(isIncludeHyphen bool) string

type RwxWrapper added in v0.4.4

type RwxWrapper struct {
	Owner, Group, Other Attribute
}

func GetExistingChmodRwxWrapper added in v0.5.0

func GetExistingChmodRwxWrapper(
	location string,
) (RwxWrapper, error)

func GetExistingChmodRwxWrapperMustPtr added in v0.5.0

func GetExistingChmodRwxWrapperMustPtr(
	location string,
) *RwxWrapper

func GetExistingChmodRwxWrapperPtr added in v0.5.0

func GetExistingChmodRwxWrapperPtr(
	location string,
) (*RwxWrapper, error)

func (*RwxWrapper) ApplyChmod added in v0.4.4

func (it *RwxWrapper) ApplyChmod(
	isSkipOnInvalid bool,
	fileOrDirectoryPath string,
) error

func (*RwxWrapper) ApplyLinuxChmodOnMany added in v0.5.5

func (it *RwxWrapper) ApplyLinuxChmodOnMany(
	condition *chmodins.Condition,
	locations ...string,
) error

func (*RwxWrapper) ApplyRecursive added in v0.8.0

func (it *RwxWrapper) ApplyRecursive(
	isSkipOnInvalid bool,
	location string,
) error

ApplyRecursive skip if it is a non dir path

func (RwxWrapper) AsJsonContractsBinder added in v1.3.16

func (it RwxWrapper) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*RwxWrapper) Bytes added in v0.4.4

func (it *RwxWrapper) Bytes() [3]byte

Bytes

return rwx, (Owner)(Group)(Other) byte values under 1-7

func (*RwxWrapper) Clone added in v0.5.4

func (it *RwxWrapper) Clone() *RwxWrapper

func (RwxWrapper) FriendlyDisplay added in v1.3.16

func (it RwxWrapper) FriendlyDisplay() string

FriendlyDisplay

fileModeStringFriendlyDisplayFormat : "{chmod : \"%s (%s)\"}"
fileModeStringFriendlyDisplayFormat : "{chmod : \"0777 (-rw...)\"}"

func (*RwxWrapper) HasAnyItem added in v1.3.16

func (it *RwxWrapper) HasAnyItem() bool

func (*RwxWrapper) HasChmod added in v0.4.4

func (it *RwxWrapper) HasChmod(location string) bool

func (*RwxWrapper) IsDefined added in v1.3.16

func (it *RwxWrapper) IsDefined() bool

func (*RwxWrapper) IsEmpty added in v1.3.16

func (it *RwxWrapper) IsEmpty() bool

func (*RwxWrapper) IsEqualFileMode added in v0.6.2

func (it *RwxWrapper) IsEqualFileMode(
	mode os.FileMode,
) bool

func (*RwxWrapper) IsEqualPtr added in v0.6.2

func (it *RwxWrapper) IsEqualPtr(
	next *RwxWrapper,
) bool

func (*RwxWrapper) IsEqualVarWrapper added in v0.6.2

func (it *RwxWrapper) IsEqualVarWrapper(
	rwxVariableWrapper *RwxVariableWrapper,
) bool

IsEqualVarWrapper if rwxVariableWrapper nil then returns false

func (*RwxWrapper) IsInvalid added in v1.3.16

func (it *RwxWrapper) IsInvalid() bool

func (*RwxWrapper) IsNull added in v1.3.16

func (it *RwxWrapper) IsNull() bool

func (*RwxWrapper) IsRwxEqualFileInfo added in v0.6.2

func (it *RwxWrapper) IsRwxEqualFileInfo(
	fileInfo os.FileInfo,
) bool

IsRwxEqualFileInfo if fileInfo nil then returns false

func (*RwxWrapper) IsRwxEqualLocation added in v0.6.2

func (it *RwxWrapper) IsRwxEqualLocation(
	location string,
) bool

func (*RwxWrapper) IsRwxFullEqual added in v0.6.2

func (it *RwxWrapper) IsRwxFullEqual(
	rwxFull string,
) bool

func (RwxWrapper) Json added in v1.3.16

func (it RwxWrapper) Json() corejson.Result

func (*RwxWrapper) JsonParseSelfInject added in v1.3.16

func (it *RwxWrapper) JsonParseSelfInject(
	jsonResult *corejson.Result,
) error

func (RwxWrapper) JsonPtr added in v1.3.16

func (it RwxWrapper) JsonPtr() *corejson.Result

func (*RwxWrapper) LinuxApplyRecursive added in v0.4.5

func (it *RwxWrapper) LinuxApplyRecursive(
	isSkipOnInvalid bool,
	location string,
) error

LinuxApplyRecursive skip if it is a non dir path

func (RwxWrapper) MarshalJSON added in v1.3.16

func (it RwxWrapper) MarshalJSON() ([]byte, error)

func (*RwxWrapper) MustApplyChmod added in v0.4.4

func (it *RwxWrapper) MustApplyChmod(fileOrDirectoryPath string)

func (*RwxWrapper) String added in v0.4.4

func (it *RwxWrapper) String() string

func (*RwxWrapper) ToCompiledOctalBytes3Digits added in v0.4.4

func (it *RwxWrapper) ToCompiledOctalBytes3Digits() [3]byte

ToCompiledOctalBytes3Digits return '0'(Owner + '0')(Group + '0')(Other + '0') eg. 777, 555, 755 NOT rwx return

owner -> (0 - 7 value)
group -> (0 - 7 value)
other -> (0 - 7 value)

func (*RwxWrapper) ToCompiledOctalBytes4Digits added in v0.4.4

func (it *RwxWrapper) ToCompiledOctalBytes4Digits() [4]byte

ToCompiledOctalBytes4Digits return 0rwx, '0'(Owner + '0')(Group + '0')(Other + '0') eg. 0777, 0555, 0755 NOT 0rwx

func (*RwxWrapper) ToCompiledSplitValues added in v0.4.4

func (it *RwxWrapper) ToCompiledSplitValues() (owner, group, other byte)

ToCompiledSplitValues return

owner -> (0 - 7 value)
group -> (0 - 7 value)
other -> (0 - 7 value)
eg. 777, 755 etc

func (*RwxWrapper) ToFileMode added in v0.4.4

func (it *RwxWrapper) ToFileMode() os.FileMode

func (*RwxWrapper) ToFileModeString added in v0.4.4

func (it *RwxWrapper) ToFileModeString() string

ToFileModeString 4 digit string 0rwx, example 0777

func (*RwxWrapper) ToFullRwxValueString added in v0.4.4

func (it *RwxWrapper) ToFullRwxValueString() string

ToFullRwxValueString

returns "-rwxrwxrwx" / RwxFull (10)

func (*RwxWrapper) ToFullRwxValueStringExceptHyphen added in v0.6.2

func (it *RwxWrapper) ToFullRwxValueStringExceptHyphen() string

ToFullRwxValueStringExceptHyphen returns "rwxrwxrwx", 9 chars

func (*RwxWrapper) ToFullRwxValuesChars added in v0.4.4

func (it *RwxWrapper) ToFullRwxValuesChars() []byte

ToFullRwxValuesChars "-rwxrwxrwx" Bytes values

func (*RwxWrapper) ToNonPtr added in v1.3.16

func (it *RwxWrapper) ToNonPtr() RwxWrapper

func (RwxWrapper) ToPtr added in v1.3.16

func (it RwxWrapper) ToPtr() *RwxWrapper

func (*RwxWrapper) ToRwxCompiledStr added in v0.4.4

func (it *RwxWrapper) ToRwxCompiledStr() string

ToRwxCompiledStr 3 digit string, example 777

func (*RwxWrapper) ToRwxInstruction added in v0.5.5

func (it *RwxWrapper) ToRwxInstruction(
	condition *chmodins.Condition,
) *chmodins.RwxInstruction

func (*RwxWrapper) ToRwxOwnerGroupOther added in v0.4.4

func (it *RwxWrapper) ToRwxOwnerGroupOther() *chmodins.RwxOwnerGroupOther

func (*RwxWrapper) ToUint32Octal added in v0.4.4

func (it *RwxWrapper) ToUint32Octal() uint32

func (*RwxWrapper) UnmarshalJSON added in v1.3.16

func (it *RwxWrapper) UnmarshalJSON(jsonBytes []byte) error

func (*RwxWrapper) Verify added in v0.4.4

func (it *RwxWrapper) Verify(location string) error

func (*RwxWrapper) VerifyPaths added in v0.4.4

func (it *RwxWrapper) VerifyPaths(isContinueOnError bool, locations ...string) error

type SimpleFileReaderWriter added in v1.3.16

type SimpleFileReaderWriter struct {
	ChmodDir, ChmodFile os.FileMode
	ParentDir           string // full path to the parent dir
	FilePath            string // full path to the actual file to write to or read from.
}

func (SimpleFileReaderWriter) AsJsonContractsBinder added in v1.3.16

func (it SimpleFileReaderWriter) AsJsonContractsBinder() corejson.JsonContractsBinder

func (SimpleFileReaderWriter) CacheGetSet added in v1.3.16

func (it SimpleFileReaderWriter) CacheGetSet(
	toPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (SimpleFileReaderWriter) CacheGetSetLock added in v1.3.16

func (it SimpleFileReaderWriter) CacheGetSetLock(
	toPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (*SimpleFileReaderWriter) ChmodApplier added in v1.3.16

func (it *SimpleFileReaderWriter) ChmodApplier() fwChmodApplier

func (*SimpleFileReaderWriter) ChmodVerifier added in v1.3.16

func (it *SimpleFileReaderWriter) ChmodVerifier() fwChmodVerifier

func (SimpleFileReaderWriter) Clone added in v1.3.16

func (*SimpleFileReaderWriter) ClonePtr added in v1.3.16

func (SimpleFileReaderWriter) Deserialize added in v1.3.16

func (it SimpleFileReaderWriter) Deserialize(
	toPtr interface{},
) error

Deserialize

alias for Get

func (SimpleFileReaderWriter) DeserializeLock added in v1.3.16

func (it SimpleFileReaderWriter) DeserializeLock(
	toPtr interface{},
) error

DeserializeLock

alias for Get

func (SimpleFileReaderWriter) Expire added in v1.3.16

func (it SimpleFileReaderWriter) Expire() error

Expire

Removes file on exist only
alias for RemoveOnExist

func (SimpleFileReaderWriter) ExpireLock added in v1.3.16

func (it SimpleFileReaderWriter) ExpireLock() error

ExpireLock

Removes file on exist only
alias for RemoveOnExist

func (SimpleFileReaderWriter) ExpireParentDir added in v1.3.16

func (it SimpleFileReaderWriter) ExpireParentDir() error

ExpireParentDir

warning: recursive process remove all files in it, undoable.

func (SimpleFileReaderWriter) ExpireParentDirLock added in v1.3.16

func (it SimpleFileReaderWriter) ExpireParentDirLock() error

ExpireParentDirLock

warning: recursive process remove all files in it, undoable.

func (SimpleFileReaderWriter) Get added in v1.3.16

func (it SimpleFileReaderWriter) Get(toPtr interface{}) error

func (SimpleFileReaderWriter) GetLock added in v1.3.16

func (it SimpleFileReaderWriter) GetLock(toPtr interface{}) error

func (SimpleFileReaderWriter) GetSet added in v1.3.16

func (it SimpleFileReaderWriter) GetSet(
	toPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (SimpleFileReaderWriter) GetSetLock added in v1.3.16

func (it SimpleFileReaderWriter) GetSetLock(
	toPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (SimpleFileReaderWriter) HasAnyIssues added in v1.3.16

func (it SimpleFileReaderWriter) HasAnyIssues() bool

HasAnyIssues

it.IsPathInvalid() || it.IsParentDirInvalid()

func (SimpleFileReaderWriter) HasPathIssues added in v1.3.16

func (it SimpleFileReaderWriter) HasPathIssues() bool

func (SimpleFileReaderWriter) InitializeDefaultNew added in v1.3.16

func (it SimpleFileReaderWriter) InitializeDefaultNew() (newRw *SimpleFileReaderWriter)

func (SimpleFileReaderWriter) IsExist added in v1.3.16

func (it SimpleFileReaderWriter) IsExist() bool

func (SimpleFileReaderWriter) IsParentDirInvalid added in v1.3.16

func (it SimpleFileReaderWriter) IsParentDirInvalid() bool

func (SimpleFileReaderWriter) IsParentExist added in v1.3.16

func (it SimpleFileReaderWriter) IsParentExist() bool

func (SimpleFileReaderWriter) IsPathInvalid added in v1.3.16

func (it SimpleFileReaderWriter) IsPathInvalid() bool

func (SimpleFileReaderWriter) Json added in v1.3.16

func (*SimpleFileReaderWriter) JsonParseSelfInject added in v1.3.16

func (it *SimpleFileReaderWriter) JsonParseSelfInject(
	jsonResult *corejson.Result,
) error

func (SimpleFileReaderWriter) JsonPtr added in v1.3.16

func (it SimpleFileReaderWriter) JsonPtr() *corejson.Result

func (SimpleFileReaderWriter) MarshalJSON added in v1.3.16

func (it SimpleFileReaderWriter) MarshalJSON() ([]byte, error)

func (SimpleFileReaderWriter) NewPath added in v1.3.16

func (it SimpleFileReaderWriter) NewPath(
	newLocation string,
) (newRw *SimpleFileReaderWriter)

func (SimpleFileReaderWriter) NewPathJoin added in v1.3.16

func (it SimpleFileReaderWriter) NewPathJoin(
	newLocationsFromParentDir ...string,
) (newRw *SimpleFileReaderWriter)

func (SimpleFileReaderWriter) OsFile added in v1.3.16

func (it SimpleFileReaderWriter) OsFile() (*os.File, error)

OsFile

Os open files must be closed

func (SimpleFileReaderWriter) Read added in v1.3.16

func (it SimpleFileReaderWriter) Read() ([]byte, error)

func (SimpleFileReaderWriter) ReadLock added in v1.3.16

func (it SimpleFileReaderWriter) ReadLock() ([]byte, error)

func (SimpleFileReaderWriter) ReadMust added in v1.3.16

func (it SimpleFileReaderWriter) ReadMust() []byte

func (SimpleFileReaderWriter) ReadOnExist added in v1.3.16

func (it SimpleFileReaderWriter) ReadOnExist() ([]byte, error)

func (SimpleFileReaderWriter) ReadOnExistLock added in v1.3.16

func (it SimpleFileReaderWriter) ReadOnExistLock() ([]byte, error)

func (SimpleFileReaderWriter) ReadString added in v1.3.16

func (it SimpleFileReaderWriter) ReadString() (content string, err error)

func (SimpleFileReaderWriter) ReadStringLock added in v1.3.16

func (it SimpleFileReaderWriter) ReadStringLock() (content string, err error)

func (SimpleFileReaderWriter) ReadStringMust added in v1.3.16

func (it SimpleFileReaderWriter) ReadStringMust() (content string)

func (SimpleFileReaderWriter) ReadStringOnExist added in v1.3.16

func (it SimpleFileReaderWriter) ReadStringOnExist() (content string, err error)

func (SimpleFileReaderWriter) ReadStringOnExistLock added in v1.3.16

func (it SimpleFileReaderWriter) ReadStringOnExistLock() (content string, err error)

func (SimpleFileReaderWriter) ReadWrite added in v1.3.16

func (it SimpleFileReaderWriter) ReadWrite(
	readToPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (SimpleFileReaderWriter) ReadWriteLock added in v1.3.16

func (it SimpleFileReaderWriter) ReadWriteLock(
	readToPtr interface{},
	onInvalidGenerateFunc func() (interface{}, error),
) error

func (SimpleFileReaderWriter) RemoveDirOnExist added in v1.3.16

func (it SimpleFileReaderWriter) RemoveDirOnExist() error

RemoveDirOnExist

alias for ExpireParentDir
warning: recursive process remove all files in it, undoable.

func (SimpleFileReaderWriter) RemoveOnExist added in v1.3.16

func (it SimpleFileReaderWriter) RemoveOnExist() error

func (SimpleFileReaderWriter) Serialize added in v1.3.16

func (it SimpleFileReaderWriter) Serialize() ([]byte, error)

Serialize

alias for ReadOnExist

func (SimpleFileReaderWriter) SerializeLock added in v1.3.16

func (it SimpleFileReaderWriter) SerializeLock() ([]byte, error)

SerializeLock

alias for ReadOnExist

func (SimpleFileReaderWriter) Set added in v1.3.16

func (it SimpleFileReaderWriter) Set(toPtr interface{}) error

Set

alias for WriteAny

func (SimpleFileReaderWriter) SetLock added in v1.3.16

func (it SimpleFileReaderWriter) SetLock(toPtr interface{}) error

func (SimpleFileReaderWriter) String added in v1.3.16

func (it SimpleFileReaderWriter) String() string

func (*SimpleFileReaderWriter) UnmarshalJSON added in v1.3.16

func (it *SimpleFileReaderWriter) UnmarshalJSON(jsonBytes []byte) error

func (SimpleFileReaderWriter) Write added in v1.3.16

func (it SimpleFileReaderWriter) Write(allBytes []byte) error

func (SimpleFileReaderWriter) WriteAny added in v1.3.16

func (it SimpleFileReaderWriter) WriteAny(
	anyItem interface{},
) error

func (SimpleFileReaderWriter) WriteAnyLock added in v1.3.16

func (it SimpleFileReaderWriter) WriteAnyLock(
	anyItem interface{},
) error

func (SimpleFileReaderWriter) WriteString added in v1.3.16

func (it SimpleFileReaderWriter) WriteString(content string) error

type SingleRwx added in v0.5.5

type SingleRwx struct {
	// Rwx Index Values
	//  - 0: 'r'/'*'/'-'
	//  - 1: 'w'/'*'/'-'
	//  - 2: 'x'/'*'/'-'
	// Examples can be :
	//  - "rwx" or
	//  - "*wx" or
	//  - "rw*" or
	//  - "***"
	//
	// Length must be 3. Not more not less.
	Rwx       string
	ClassType chmodclasstype.Variant
}

func NewSingleRwx added in v0.5.5

func NewSingleRwx(
	rwx string,
	classType chmodclasstype.Variant,
) (*SingleRwx, error)

func (*SingleRwx) ApplyOnMany added in v0.5.5

func (it *SingleRwx) ApplyOnMany(
	condition *chmodins.Condition,
	locations ...string,
) error

func (*SingleRwx) ToDisabledRwxWrapper added in v0.5.5

func (it *SingleRwx) ToDisabledRwxWrapper() (*RwxWrapper, error)

func (*SingleRwx) ToRwxInstruction added in v0.5.5

func (it *SingleRwx) ToRwxInstruction(
	conditionalIns *chmodins.Condition,
) *chmodins.RwxInstruction

func (*SingleRwx) ToRwxOwnerGroupOther added in v0.5.5

func (it *SingleRwx) ToRwxOwnerGroupOther() *chmodins.RwxOwnerGroupOther

func (*SingleRwx) ToRwxWrapper added in v0.5.5

func (it *SingleRwx) ToRwxWrapper() (*RwxWrapper, error)

func (*SingleRwx) ToVarRwxWrapper added in v0.5.5

func (it *SingleRwx) ToVarRwxWrapper() (*RwxVariableWrapper, error)

type VarAttribute added in v0.4.1

type VarAttribute struct {
	// contains filtered or unexported fields
}

func ParseRwxToVarAttribute added in v0.4.1

func ParseRwxToVarAttribute(rwx string) (varAttribute *VarAttribute, err error)

func (*VarAttribute) Clone added in v0.5.4

func (it *VarAttribute) Clone() *VarAttribute

func (*VarAttribute) HasWildcard added in v0.6.2

func (it *VarAttribute) HasWildcard() bool

func (*VarAttribute) IsEqualPtr added in v0.6.2

func (it *VarAttribute) IsEqualPtr(next *VarAttribute) bool

func (*VarAttribute) IsFixedType added in v0.4.1

func (it *VarAttribute) IsFixedType() bool

func (*VarAttribute) String added in v0.6.2

func (it *VarAttribute) String() string

func (*VarAttribute) ToCompileAttr added in v0.4.1

func (it *VarAttribute) ToCompileAttr(fixed *Attribute) Attribute

ToCompileAttr

if fixed type then fixed param can be nil

func (*VarAttribute) ToCompileFixAttr added in v0.4.1

func (it *VarAttribute) ToCompileFixAttr() *Attribute

ToCompileFixAttr

must check IsFixedType, before calling.

type Variant

type Variant string
const (
	AllRead                             Variant = "444"
	AllWrite                            Variant = "222"
	AllExecute                          Variant = "111"
	AllReadWrite                        Variant = "666"
	AllReadExecute                      Variant = "555"
	AllWriteExecute                     Variant = "333"
	OwnerAllReadWriteGroupOther         Variant = "755"
	ReadWriteOwnerReadGroupOther        Variant = "644"
	ReadWriteOwnerReadExecuteGroupOther Variant = "655"
	X111                                Variant = "111"
	X222                                Variant = "222"
	X333                                Variant = "333"
	X444                                Variant = "444"
	X555                                Variant = "555"
	X644                                Variant = "644"
	X655                                Variant = "655"
	X666                                Variant = "666"
	X677                                Variant = "677"
	X711                                Variant = "711"
	X722                                Variant = "722"
	X733                                Variant = "733"
	X744                                Variant = "744"
	X755                                Variant = "755"
	X766                                Variant = "766"
	X777                                Variant = "777"
)

func (Variant) ExpandOctalByte added in v0.5.6

func (it Variant) ExpandOctalByte() (r7, w7, x7 byte)

ExpandOctalByte

returns byte values at most 7 for each.

func (Variant) String

func (it Variant) String() string

func (Variant) ToWrapper

func (it Variant) ToWrapper() (RwxWrapper, error)

func (Variant) ToWrapperPtr added in v0.5.6

func (it Variant) ToWrapperPtr() (*RwxWrapper, error)

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL