Skip to content
Snippets Groups Projects
Commit 11371eed authored by sivan's avatar sivan
Browse files

refactoring kinda done

parent 5479b2dc
No related branches found
No related tags found
No related merge requests found
package redisclient
import "context"
// UseCase is an interface describing the redis service
type UseCase interface {
// GetRouting will retrieve the client updated service ID
// to publish the result to
// Requires the client request sessionID
GetRouting(context.Context, *string)
}
package redisclient
import (
"context"
"query-service/internal/entity"
)
// Service wraps redis usecases
type Service struct {
}
// NewService creates a new redis service and returns it
func NewService() *Service {
return &Service{}
}
// GetRouting get the client update service queue id
// Takes the context and the sessionID
func (s *Service) GetRouting(ctx context.Context, sessionID *string) *string {
clientUpdaterID := entity.RedisClient.Get(ctx, *sessionID).Val()
return &clientUpdaterID
}
package request
// UseCase is an interface describing the request usecases
type UseCase interface {
SendAQLQuery(query string) (*[]Document, error)
}
...@@ -13,6 +13,13 @@ import ( ...@@ -13,6 +13,13 @@ import (
"github.com/arangodb/go-driver/http" "github.com/arangodb/go-driver/http"
) )
type Service struct {
}
func NewService() *Service {
return &Service{}
}
// Document with Empty struct to retrieve all data from the DB Document // Document with Empty struct to retrieve all data from the DB Document
type Document map[string]interface{} type Document map[string]interface{}
...@@ -24,7 +31,7 @@ type GeneralFormat map[string][]Document ...@@ -24,7 +31,7 @@ type GeneralFormat map[string][]Document
//map[1 , 2 , 3 map [ .. ]] //map[1 , 2 , 3 map [ .. ]]
// SendAQLQuery send AQL string query to database and returns a JSON object in a general format // SendAQLQuery send AQL string query to database and returns a JSON object in a general format
func SendAQLQuery(AQLQuery string) (*[]Document, error) { func (s *Service) SendAQLQuery(AQLQuery string) (*[]Document, error) {
var queryResult []Document var queryResult []Document
conn, err := http.NewConnection(http.ConnectionConfig{ conn, err := http.NewConnection(http.ConnectionConfig{
Endpoints: []string{"https://aae8f5c054da.arangodb.cloud:8529"}, Endpoints: []string{"https://aae8f5c054da.arangodb.cloud:8529"},
......
File deleted
...@@ -82,19 +82,5 @@ ...@@ -82,19 +82,5 @@
"state": "NY", "state": "NY",
"vip": false "vip": false
} }
},
{
"_id": "airports/01J",
"_key": "01J",
"_rev": "_cIYKbri--H",
"attributes": {
"city": "Hilliard",
"country": "USA",
"lat": 30.6880125,
"long": -81.90594389,
"name": "Hilliard Airpark",
"state": "FL",
"vip": false
}
} }
] ]
\ No newline at end of file
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