Skip to content
Snippets Groups Projects
Commit b03c075b authored by thijsheijden's avatar thijsheijden
Browse files

Added mock query conversion service

parent 59f3fb1d
No related branches found
No related tags found
No related merge requests found
package mockconvertquery
import "errors"
// A Service implements the query convert usecase interface (mock)
type Service struct {
throwError bool
}
// NewService creates a new query convert service (mock)
func NewService() *Service {
return &Service{}
return &Service{
throwError: false,
}
}
// ConvertQuery returns a hard coded string message (mock)
func (s *Service) ConvertQuery(jsonMsg *[]byte) (*string, error) {
mockQuery := "Query converted"
return &mockQuery, nil
if !s.throwError {
return &mockQuery, nil
}
return nil, errors.New("Failed to convert query")
}
// ToggleError decides whether the convert function throws an error
func (s *Service) ToggleError() {
s.throwError = !s.throwError
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment