From b923a292af1f5f3bc3c239a9dde791d5e2f36567 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 15 Feb 2022 11:57:25 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20m=C3=A9thode=20d'instanciation?= =?UTF-8?q?=20et=20d'un=20syst=C3=A8me=20de=20regex=20compilable=201=20seu?= =?UTF-8?q?l=20fois=20(Optimisation)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/protocol/rules/HelloRule.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/protocol/rules/HelloRule.go b/pkg/protocol/rules/HelloRule.go index 6f294a0..9da5f75 100644 --- a/pkg/protocol/rules/HelloRule.go +++ b/pkg/protocol/rules/HelloRule.go @@ -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") }