Questions tagged [ballerina-swan-lake]
Swan Lake is version 2 of the Ballerina programming language. Use this tag for questions about using this version of the Ballerina language.
ballerina-swan-lake
75
questions
1
vote
1
answer
52
views
Versions in the dependency graph in modules and the actual modules in the pack in Ballerina
What are the scenarios can a version of a dependency of module foo (let's say bar) differs from the version packed in the pack?
Let's take crypto module. It is a dependency of module auth. When we ...
0
votes
1
answer
68
views
How does the field access behave after cloning a constant map in Ballerina
Consider the following code:
import ballerina/io;
type User record {|
string name;
string email;
|};
const USER = {
name: "John Doe",
email: "[email protected]"
}...
0
votes
1
answer
48
views
Clarification on type inclusions in record in Ballerina
I have defined records like this:
type Record1 record {|
int a;
string b;
string...;
|};
type Record2 record {|
boolean c;
string[] d;
int...;
|};
type Record record {
*...
1
vote
1
answer
39
views
The assertExactEquals is not working as expected for errors Ballerina testing
This happened while I was writing some tests and below is a sample code.
main.bal
public function testError() returns error? {
io:println("testError executed");
return error("...
0
votes
1
answer
31
views
Compilation fails with gmail connector in Ballerina
gmail:Client gmail = check new ({auth: {token: gmailToken}});
gmail:Message sendMessage = check gmail->sendMessage(messageRequest);
With the above code, I get the following compilation error.
...
1
vote
1
answer
40
views
Find intersection of 2 arrays in Ballerina
I have 2 arrays (batsmen and bowlers). Whats the best way to find the intersection of these and create the allrounders array?
public type Player record {
int id;
string name;
};
Player[] ...
2
votes
2
answers
86
views
How do I write prepared statements in ballerina?
Is there a way to write prepared statements for SQL in ballerina? or is it a good practice to use the following method for that?
function selectUserQuery(string username) returns sql:...
0
votes
2
answers
104
views
Ballerina: undefined function 'getItemType' in type 'xml'
import ballerina/io;
import ballerina/lang.'xml;
public function main() returns error? {
xml x = xml `<book>Hamlet</book><book>Macbeth</book>`;
xml mappedXml = x.map(...
0
votes
1
answer
35
views
How do I organize microservices in a ballerina programme?
I'm implementing a cloud native microservice application using Ballerina as a part of a university project. I've been trying to figure out how to organize the code in the package, understand what a ...
0
votes
1
answer
35
views
BatchExecute command fails for SQL Server and JDBC connectors in Ballerina
When trying out batch execute command in SQL Server for an array of insert queries, the operation fails with following error message in Ballerina:
Error while executing batch command starting with: '...
0
votes
1
answer
35
views
How do I specify ballerina version in ballerina github action?
I am currently using ballerina-action GitHub action in my workflow. It seems Ballerina version is hardcoded in the Dockerfile of the GitHub action here. Is there a way to give a specific ballerina ...
0
votes
1
answer
46
views
Ballerina jdbc DB Client throws error when select query returns empty result
I have a function to read the Notifiers table in my db and check if there is a user by a userId. If the user is there, I return that user's last seen time, if the user is not present, I write a new ...
0
votes
0
answers
22
views
bal build/pull throws "package not found: ballerinax/prometheus"
Team,
Is there a way to fetch debug logs of the commands executed through bal tool.
Ex: bal build (or) bal pull .
I am getting package not found error when I execute above commands even though I am ...
0
votes
1
answer
50
views
How to set up an OAuth2 token endpoint?
In the BBE https://ballerina.io/learn/by-example/http-client-oauth2-client-credentials-grant-type/, there is an OAuth2 token endpoint configured on https://localhost:9445/oauth2/token.
http:Client ...
0
votes
1
answer
30
views
VS Code does not resolve Ballerina modules and gives syntax errors
When a ballerina project is opened with VS code, some modules and syntax are not resolved. I have installed Ballerina VS Code plugin 3.3.13 and the Ballerina version is Ballerina 2201.4.1 (Swan Lake ...