Ajout d'une méthode d'instanciation et d'un système de regex compilable 1 seul fois (Optimisation)

This commit is contained in:
Benjamin Lejeune 2022-02-15 11:57:25 +01:00
parent 3715e752ba
commit b923a292af

View File

@ -3,14 +3,19 @@ package rules
import "_StorBackEnd/pkg/protocol"
type HelloRule struct {
cmd string
matcher *protocol.RegexMatcher
}
func (h HelloRule) Create(cmd string, pattern string) protocol.IProtocol {
//TODO implement me
panic("implement me")
}
func (h HelloRule) execute(data string) {
func Create(cmd string, pattern string) *HelloRule {
h := new(HelloRule)
h.cmd = cmd
h.matcher = protocol.CreateRegexMatcher(pattern)
return h
}
func (rule HelloRule) execute(data string) {
//TODO implement me
panic("implement me")
}