-
thijsheijden authoredthijsheijden authored
Query Service
This service handles the conversion and execution of queries sent from the frontend. The conversion and execution code was moved into packages, to be able to re-use this service as the shell. Query conversion code (to convert from our JSON format to AQL or Cypher) lives in this repo and query execution code lives in this repo.
The reason the conversion and execution code are seperated is because there can be multiple databases using the same query language, while they each have their own driver.
Dev Dependencies
Here are the developer dependencies. Coding can be done without these tools, but they sure make your life easier.
- Make
- Docker
Dependencies
This service depends on quite some other services, as it is essentially just a shell for the query conversion and execution packages.
- RabbitMQ
- Redis
- Minio
- User management service (for database credentials)
Environment Variables
To decide which conversion and execution packages will be used the service uses environment variables. The QUERY_CONVERSION_LANGUAGE
variable determines which query conversion package will be used. Currently only aql
and cypher
are supported. The QUERY_EXECUTION
variable determines the executor that will be used. This variable also changes the queue and routing key the service listens to, as can be seen here on line 41.
There are some more environment variables that are used in this service, which are listed below:
-
RABBIT_HOST
address of the RabbitMQ instance (string) -
RABBIT_PORT
RabbitMQ port (int) -
RABBIT_USER
RabbitMQ username (string) -
RABBIT_PASSWORD
RabbitMQ password (string) -
REDIS_ADDRESS
Redis address (string) -
LOG_MESSAGES
Whether to log messages (bool) -
MINIO_ADDRESS
Minio address (string) -
MINIO_ACCESSKEYID
Minio username (string) -
MINIO_ACCESSKEY
Minio password (string)
Building the Service
To compile the service into a single binary, the following commands can be used. Go can build for many platforms, so we have three build commands, for the three main platforms.
make linux
make windows
make macos
To build the service and push it to the Docker registry the make docker
command can be used.