30 lines
641 B
Go
30 lines
641 B
Go
package writers
|
|
|
|
import "StorBackEnd/pkg/protocol"
|
|
|
|
const HelloRuleName = "sbe_hello"
|
|
|
|
type HelloRule struct {
|
|
// Cmd Nom de la règle
|
|
Cmd string
|
|
|
|
// matcher Permet d'extraire de éléments d'une chaine
|
|
matcher *protocol.RegexMatcher
|
|
}
|
|
|
|
// CreateHelloRule Création d'une instance de HelloRule
|
|
func CreateHelloRule(pattern string) protocol.IProtocolWriter {
|
|
return &HelloRule{
|
|
Cmd: HelloRuleName,
|
|
matcher: protocol.CreateRegexMatcher(pattern),
|
|
}
|
|
}
|
|
|
|
func (rule HelloRule) GetCmd() string {
|
|
return rule.Cmd
|
|
}
|
|
|
|
func (rule HelloRule) Execute(argsData ...string) (string, bool) {
|
|
return rule.matcher.Build("HELLO", argsData...)
|
|
}
|