Documentation ¶
Index ¶
- func DirSize(opname, value string, larger bool) boolexpr.Operand
- func DirSizeLarger(n, v string) boolexpr.Operand
- func DirSizeSmaller(n, v string) boolexpr.Operand
- func FileSize(opname, value string, larger bool) boolexpr.Operand
- func FileSizeLarger(n, v string) boolexpr.Operand
- func FileSizeSmaller(n, v string) boolexpr.Operand
- func FileType(opname string, typ string) boolexpr.Operand
- func Glob(opname string, pat string, caseInsensitive bool) boolexpr.Operand
- func New() *boolexpr.Parser
- func NewDirSizeLarger(n, v string) boolexpr.Operand
- func NewDirSizeSmaller(n, v string) boolexpr.Operand
- func NewFileSizeLarger(n, v string) boolexpr.Operand
- func NewFileSizeSmaller(n, v string) boolexpr.Operand
- func NewFileType(n, v string) boolexpr.Operand
- func NewGlob(n, v string) boolexpr.Operand
- func NewGroup(name, value string, parser XAttrParser) boolexpr.Operand
- func NewIGlob(n, v string) boolexpr.Operand
- func NewNewerThan(n, v string) boolexpr.Operand
- func NewRegexp(n, v string) boolexpr.Operand
- func NewUser(name, value string, parser XAttrParser) boolexpr.Operand
- func NewerThanParsed(opname string, value string) boolexpr.Operand
- func NewerThanTime(opname string, when time.Time) boolexpr.Operand
- func ParseGroupnameOrID(nameOrID string, lookup func(name string) (user.Group, error)) (file.XAttr, error)
- func ParseUsernameOrID(nameOrID string, lookup func(name string) (userid.IDInfo, error)) (file.XAttr, error)
- func Regexp(opname string, re string) boolexpr.Operand
- func XAttr(opname, value, doc string, prepare XAttrParser, ...) boolexpr.Operand
- type DirSizeIfc
- type FileModeIfc
- type FileSizeIfc
- type FileTypeIfc
- type ModTimeIfc
- type NameIfc
- type PathIfc
- type XAttrIfc
- type XAttrParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirSize ¶
DirSize returns a 'directory size' operand. The value is not validated until a matcher.T is created using New. The size must be expressed as an integer. If larger is true then the comparison is performed using >=, otherwise <. The operand requires that the value being matched implements FileTypeIfc and DirSizeIfc.
func DirSizeLarger ¶
func DirSizeSmaller ¶
func FileSize ¶
FileSize returns a 'file size' operand. The value is not validated until a matcher.T is created using New. The size may be expressed as an in binary (GiB, KiB) or decimal (GB, KB) or as bytes (eg. 1.1GB, 1GiB or 1000). If larger is true then the comparison is performed using >=, otherwise <. The operand requires that the value being matched implements FileTypeIfc and FileSizeIfc.
func FileSizeLarger ¶
func FileSizeSmaller ¶
func FileType ¶
FileType returns a 'file type' operand. It is not validated until a matcher.T is created using New. Supported file types are (as per the unix find command):
- f for regular files
- d for directories
- l for symbolic links
- x executable regular files
It requires that the value being matched implements FileTypeIfc for types d, f and l and FileModeIfc for type x.
func Glob ¶
Glob provides a glob operand (optionally case insensitive, in which case the value it is being against will be converted to lower case before the match is evaluated). The pattern is not validated until a matcher.T is created. It requires that the value being matched implements NameIfc and/or PathIfc. The NameIfc interface is used first, if the value does not implement NameIfc or the glob evaluates to false, then PathIfc is used.
func New ¶
New returns a boolexpr.Parser with the following operands registered:
- "name": case sensitive Glob
- "iname", case insensitive Glob
- "re", Regxp
- "type", FileType
- "newer", NewerThan
- "dir-larger", DirSizeGreater
- "dir-smaller", DirSizeSmaller
- "file-larger", FileSizeGreater
- "file-smaller", FileSizeSmaller
func NewDirSizeLarger ¶
NewDirSizeLarger returns a boolexpr.Operand that returns true if the expression value implements DirSizeIfc and the number of entries in the directory is greater than the specified value.
func NewDirSizeSmaller ¶
NewDirSizeSmaller is like NewDirSizeLarger but returns true if the number of entries is smaller or equal than the specified value.
func NewFileSizeLarger ¶
NewFileSizeLarger returns a boolexpr.Operand that returns true if the expression value implements DirSizeIfc and the number of entries in the directory is greater than the specified value.
func NewFileSizeSmaller ¶
NewFileSizeSmaller is like NewFileSizeLarger but returns true if the number of entries is smaller or equal than the specified value.
func NewFileType ¶
NewFileType returns a boolexpr.Operand that matches a file type. The expression value must implement FileTypeIfc for types d, f and l and FileModeIfc for type x.
func NewGlob ¶
NewGlob returns a case sensitive boolexpr.Operand that matches a glob pattern. The expression value must implement NameIfc.
func NewGroup ¶
func NewGroup(name, value string, parser XAttrParser) boolexpr.Operand
NewGroup returns an operand that compares the group id of the value being evaluated with the supplied group id or name. The supplied IDLookup is used to convert the supplied text into a group id. The value being evaluated must implement the XAttrIfc interface.
func NewIGlob ¶
NewIGlob is a case-insensitive version of NewGlob. The expression value must implement NameIfc.
func NewNewerThan ¶
NewNewerThan returns a boolexpr.Operand that matches a time that is newer than the specified time. The time is specified in time.RFC3339, time.DateTime, time.TimeOnly or time.DateOnly formats. The expression value must implement ModTimeIfc.
func NewRegexp ¶
NewRegexp returns a boolexpr.Operand that matches a regular expression. The expression value must implement NameIfc.
func NewUser ¶
func NewUser(name, value string, parser XAttrParser) boolexpr.Operand
NewUser returns an operand that compares the user id of the value being evaluated with the supplied user id or name. The supplied IDLookup is used to convert the supplied text into a user id. The value being evaluated must implement the XAttrIfc interface.
func NewerThanParsed ¶
NewerThanParsed returns a 'newer than' operand. It is not validated until a matcher.T is created using New. The time must be expressed as one of time.RFC3339, time.DateTime, time.TimeOnly, time.DateOnly. Due to the nature of the parsed formats fine grained time comparisons are not possible.
It requires that the value being matched implements ModTimeIfc.
func NewerThanTime ¶
NewerThanTime returns a 'newer than' operand with the specified time. This should be used in place of NewerThanFormat when fine grained time comparisons are required.
It requires that the value bein matched implements Mod
func ParseGroupnameOrID ¶
func ParseGroupnameOrID(nameOrID string, lookup func(name string) (user.Group, error)) (file.XAttr, error)
ParseGroupnameOrID returns a file.XAttr that represents the supplied name or ID.
func ParseUsernameOrID ¶
func ParseUsernameOrID(nameOrID string, lookup func(name string) (userid.IDInfo, error)) (file.XAttr, error)
ParseUsernameOrID returns a file.XAttr that represents the supplied name or ID.
Types ¶
type DirSizeIfc ¶
type DirSizeIfc interface {
NumEntries() int64
}
DirSizeIfc must be implemented by any values that are used with the DirSize operand.
type FileModeIfc ¶
FileModeIfc must be implemented by any values that are used with the Filetype operand for type x.
type FileSizeIfc ¶
type FileSizeIfc interface {
Size() int64
}
FileSizeIfc must be implemented by any values that are used with the FileSize operand.
type FileTypeIfc ¶
FileTypeIfc must be implemented by any values that are used with the Filetype operand for types f, d or l.
type ModTimeIfc ¶
ModTimeIfc must be implemented by any values that are used with the NewerThan operand.
type NameIfc ¶
type NameIfc interface {
Name() string
}
NameIfc and/or PathIfc must be implemented by any values that are used with the Glob operands.
type PathIfc ¶
type PathIfc interface {
Path() string
}
PathIfc must be implemented by any values that are used with the Regexp operand optionally for the Glob operand.