2022-02-20 11:55:11 +01:00
|
|
|
package protocol
|
|
|
|
|
2022-02-20 12:35:05 +01:00
|
|
|
import "_StorBackEnd/pkg/protocol/repository"
|
|
|
|
|
2022-02-20 11:55:11 +01:00
|
|
|
type RequestManager struct {
|
2022-02-22 08:29:11 +01:00
|
|
|
Repository *repository.ProtocolRepository
|
2022-02-20 11:55:11 +01:00
|
|
|
}
|
|
|
|
|
2022-02-20 12:35:05 +01:00
|
|
|
func (receiver RequestManager) Execute(request string) string {
|
2022-02-20 11:55:11 +01:00
|
|
|
// On lis ce que l'on reçoit
|
2022-02-22 08:29:11 +01:00
|
|
|
result, executed := receiver.Repository.ExecuteReader(request)
|
2022-02-20 11:55:11 +01:00
|
|
|
|
|
|
|
// On renvoie la réponse (Comment pour fichier ?)
|
2022-02-20 12:35:05 +01:00
|
|
|
if executed {
|
|
|
|
return result
|
|
|
|
} else {
|
|
|
|
// TODO : Renvoyer qu'une erreur est survenue
|
|
|
|
return "Error occured while execute command"
|
|
|
|
}
|
2022-02-20 11:55:11 +01:00
|
|
|
}
|