StoreBackEnd/pkg/protocol/rules/readers/EraseFileRule.go

32 lines
714 B
Go

package readers
import "_StorBackEnd/pkg/protocol"
// EraseFileRule Demande de suppression d'un fichier
type EraseFileRule struct {
protocol.IProtocolReader
// Cmd Nom de la règle
Cmd string
// matcher Permet de vérifier le matching
matcher *protocol.RegexMatcher
}
// CreateEraseFileRule Création d'une instance de EraseFileRule
func CreateEraseFileRule(cmd string, pattern string) *EraseFileRule {
return &EraseFileRule{
Cmd: cmd,
matcher: protocol.CreateRegexMatcher(pattern),
}
}
func (rule EraseFileRule) execute(data string) {
matcher := rule.matcher
if matcher.Match(data) {
println("EraseFileRule data is matching")
} else {
println("EraseFileRule data isn't matching")
}
}