Documentation
¶
Overview ¶
Package matcher define common resource matcher
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filepath ¶
Filepath returns filepath based filepath matcher
// The pattern syntax is: // // pattern: // { term } // term: // '*' matches any sequence of non-Separator characters // '?' matches any single non-Separator character // '[' [ '^' ] { character-range } ']' // character class (must be non-empty) // c matches character c (c != '*', '?', '\\', '[') // '\\' c matches character c
Types ¶
type Basic ¶
type Basic struct {
Prefix string `json:",omitempty"`
Suffix string `json:",omitempty"`
Filter string `json:",omitempty"`
Exclusion string `json:",omitempty"`
Directory *bool `json:",omitempty"`
// contains filtered or unexported fields
}
Basic represents prefix, suffix or regexp matcher
func (*Basic) Match ¶
Match matcher parent and info with matcher rules
Example ¶
package main
import (
"fmt"
"github.com/viant/afs/file"
"github.com/viant/afs/matcher"
"log"
"time"
)
func main() {
basicMatcher, err := matcher.NewBasic("", "", "asset\\d+\\.txt", nil)
if err != nil {
log.Fatal(err)
}
matched := basicMatcher.Match("parent location", file.NewInfo("asset001.txt", 20, 0644, time.Now(), false))
fmt.Printf("matched: %v\n", matched)
}
type Ignore ¶
Ignore matcher represents matcher that matches file that are not in the ignore rules. The syntax of ignore borrows heavily from that of .gitignore; see https://git-scm.com/docs/gitignore or man gitignore for a full reference.
Each line is one of the following:
pattern: a pattern specifies file names to ignore (or explicitly include) in the upload. If multiple patterns match the file name, the last matching pattern takes precedence. comment: comments begin with # and are ignored (see "ADVANCED TOPICS" for an exception). If you want to include a # at the beginning of a pattern, you must escape it: \#. blank line: A blank line is ignored and useful for readability.
func WithExtExclusion ¶ added in v1.23.0
WithExtExclusion returns an ignore with ext exclusion
type Modification ¶
type Modification struct {
After *time.Time
Before *time.Time
// contains filtered or unexported fields
}
Modification represents modification matcher
func NewModification ¶
func NewModification(before, after *time.Time, matchers ...option.Match) *Modification
NewModification creates a modification time matcher