package writers import "StoreBackEnd/pkg/protocol" // SendOkRulePrefix Rule command prefix const SendOkRulePrefix = "SEND_OK" // SendOkRule Storage structure for the SendOkRule type SendOkRule struct { // cmd Rule name cmd string // matcher Allow to make a regex match matcher *protocol.RegexMatcher } // CreateSendOkRule Creating an instance of SendOkRule func CreateSendOkRule(pattern string) protocol.IProtocolWriter { return &SendOkRule{ cmd: SendOkRulePrefix, matcher: protocol.CreateRegexMatcher(pattern), } } // GetCmd retrieve the command name. func (rule SendOkRule) GetCmd() string { return rule.cmd } // Execute the Rule with a string command. func (rule SendOkRule) Execute(argsData ...string) (string, bool) { return rule.matcher.Build(SendOkRulePrefix, argsData...) }