Skip to content

Instantly share code, notes, and snippets.

View Manuri's full-sized avatar
🎯
Focusing

Manuri Amaya Perera Manuri

🎯
Focusing
View GitHub Profile
import ballerina/io;
import ballerinax/jdbc;
public type EmployeeOracle record {
string first_name;
string last_name;
float id;
float salary;
};
package org.sample;
public class Main {
public static void main(String[] args) {
System.out.println("Hello");
}
}
import ballerina/http;
import ballerina/io;
import wso2/mongodb;
import ballerinax/docker;
@docker:Expose{}
endpoint http:Listener Servicelistner {
port : 9090
};
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
import ballerina/mysql;
import ballerina/io;
public type Employee record {
int id;
};
public function main(int arg) {
endpoint mysql:Client testDB {
host: "localhost",
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:test1@cluster0-shard-00-00-gyqsg.mongodb.net: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"}
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;
}
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;
}
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;
}
import ballerina/io;
type Salary record {
int id,
float salary,
};
type Person record {
int id,
float salary,