This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
import ballerinax/jdbc; | |
public type EmployeeOracle record { | |
string first_name; | |
string last_name; | |
float id; | |
float salary; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.sample; | |
public class Main { | |
public static void main(String[] args) { | |
System.out.println("Hello"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/http; | |
import ballerina/io; | |
import wso2/mongodb; | |
import ballerinax/docker; | |
@docker:Expose{} | |
endpoint http:Listener Servicelistner { | |
port : 9090 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ballerina/ballerina:0.983.0 | |
RUN mkdir /ballerina/mongodb | |
COPY wso2-mongodb-0.7.1.zip /ballerina/mongodb/ | |
RUN unzip /ballerina/mongodb/wso2-mongodb-0.7.1.zip -d /ballerina/mongodb/ | |
RUN cd /ballerina/mongodb/ && printf '/ballerina/runtime' | sh install.sh | |
RUN rm -r /ballerina/mongodb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/mysql; | |
import ballerina/io; | |
public type Employee record { | |
int id; | |
}; | |
public function main(int arg) { | |
endpoint mysql:Client testDB { | |
host: "localhost", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wso2/mongodb; | |
import ballerina/io; | |
public function main() { | |
// All 3 of the following endpoint declarations would work. You can try either of them. I'll leave two of them commented out. | |
// Feel free to replace the configuration with yours and try these out. | |
endpoint mongodb:Client conn { | |
dbName: "test", | |
options : { url: "mongodb://test1:[email protected]:27017,cluster0-shard-00-01-gyqsg.mongodb.net:27017,cluster0-shard-00-02-gyqsg.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table dt = check testDB->select("SELECT FirstName from Customers where registrationID = 1", ResultCustomers); | |
while (dt.hasNext()) { | |
ResultCustomers rs = check <ResultCustomers>dt.getNext(); | |
if (rs.ID > 10) { | |
break; | |
} else { | |
id = rs.ID; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table dt = check testDB->select("SELECT FirstName from Customers where registrationID = 1", ResultCustomers); | |
while (dt.hasNext()) { | |
ResultCustomers rs = check <ResultCustomers>dt.getNext(); | |
return rs.FIRSTNAME; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table dt = check testDB->select("SELECT FirstName from Customers where registrationID = 1", ResultCustomers); | |
if (dt.hasNext()) { | |
ResultCustomers rs = check <ResultCustomers>dt.getNext(); | |
firstName = rs.FIRSTNAME; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
type Salary record { | |
int id, | |
float salary, | |
}; | |
type Person record { | |
int id, | |
float salary, |
NewerOlder