-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bal
28 lines (25 loc) · 948 Bytes
/
main.bal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import ballerina/log;
import ballerinax/mysql;
import ballerina/sql;
import CCTransactionApp.dbConnector;
configurable int appPort = ?;
configurable string appHost = ?;
public function main() {
connectDB();
error? startResult = appListener.start();
if (startResult is error) {
log:printError("Error starting listener");
}
}
function connectDB() {
mysql:Client|sql:Error|() initializeClientResult = dbConnector:initializeClient();
if (initializeClientResult is sql:Error) {
panic error("Query execution failed!\n", initializeClientResult);
} else if (initializeClientResult is ()) {
panic error("Query returned nil\n", initializeClientResult);
} else {
stream<dbConnector:User, sql:Error> blackListResult = dbConnector:retrieveBlackList(initializeClientResult);
dbConnector:cacheBlackList(blackListResult);
sql:Error? close = initializeClientResult.close();
}
}