- Changement des entêtes dans le projets.

This commit is contained in:
Maximilien LEDOUX
2022-03-12 15:57:27 +01:00
parent 4975c4e454
commit f75948c3bb
14 changed files with 124 additions and 72 deletions

View File

@@ -27,6 +27,10 @@ func (rule HelloRule) GetCmd() string {
}
// Execute the Rule with a string command.
func (rule HelloRule) Execute(argsData ...string) (string, bool) {
return rule.matcher.Build(HelloRulePrefix, argsData...)
func (rule HelloRule) Execute(argsData ...string) *protocol.ProtocolWriterResult {
cmd, _ := rule.matcher.Build(HelloRulePrefix, argsData...)
return &protocol.ProtocolWriterResult{
Cmd: cmd,
}
}

View File

@@ -1,6 +1,8 @@
package writers
import "StoreBackEnd/pkg/protocol"
import (
"StoreBackEnd/pkg/protocol"
)
// SendErrorRulePrefix Rule command prefix
const SendErrorRulePrefix = "SEND_ERROR"
@@ -27,6 +29,17 @@ func (rule SendErrorRule) GetCmd() string {
}
// Execute the Rule with a string command.
func (rule SendErrorRule) Execute(argsData ...string) (string, bool) {
return rule.matcher.Build(SendErrorRulePrefix, argsData...)
func (rule SendErrorRule) Execute(argsData ...string) *protocol.ProtocolWriterResult {
buildedCmd, _ := rule.matcher.Build(SendErrorRulePrefix, argsData...)
return &protocol.ProtocolWriterResult{
Cmd: buildedCmd,
}
}
/*
func onWrite(writer *bufio.Writer) {
println("Ecriture du fichier sur le réseau")
}
*/

View File

@@ -1,6 +1,8 @@
package writers
import "StoreBackEnd/pkg/protocol"
import (
"StoreBackEnd/pkg/protocol"
)
// SendOkRulePrefix Rule command prefix
const SendOkRulePrefix = "SEND_OK"
@@ -27,6 +29,10 @@ func (rule SendOkRule) GetCmd() string {
}
// Execute the Rule with a string command.
func (rule SendOkRule) Execute(argsData ...string) (string, bool) {
return rule.matcher.Build(SendOkRulePrefix, argsData...)
func (rule SendOkRule) Execute(argsData ...string) *protocol.ProtocolWriterResult {
buildedCmd, _ := rule.matcher.Build(SendOkRulePrefix, argsData...)
return &protocol.ProtocolWriterResult{
Cmd: buildedCmd,
}
}