This file contains 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 Student record {| | |
int id; | |
string name; | |
|}; | |
public function main() returns error? { | |
// As JSON is a union: `()|boolean|int|float|decimal|string|json[]|map<json>`, | |
// the following cases are allowed. |
This file contains 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; | |
public function main() { | |
io:println("Hello, World!"); | |
} |
This file contains 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; | |
// Define an open record type to describe both the payload on the wire and the data in memory | |
type Country record { | |
string country; | |
int population; | |
string continent; | |
int cases; | |
int deaths; |
This file contains 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 record_to_edi.sorder; | |
public function main() returns error? { | |
sorder:SimpleOrder simpleOrder = | |
{header: {code: "HDR", orderId: "ORDER_200", organization: "HMart", date: "17-05-2023"}}; | |
simpleOrder.items.push({code: "ITM", item: "A680", quantity: 15}); | |
simpleOrder.items.push({code: "ITM", item: "A530", quantity: 2}); | |
simpleOrder.items.push({code: "ITM", item: "A500", quantity: 4}); | |
string ediText = check sorder:toEdiString(simpleOrder); |
This file contains 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; | |
public function main() { | |
io:println("Hello Ballerina!"); | |
} |
This file contains 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
[wrapping] | |
simpleBlocksInOneLine = true | |
[spacing] | |
aroundRecordBraces = true | |
[methodDeclaration] | |
parametersWrap = "ChopDown" | |
alignMultilineParameters = true |
This file contains 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; | |
// Define an open record type to describe both the payload on the wire and the data in memory | |
type Country record { | |
string country; | |
int population; | |
string continent; | |
int cases; | |
int deaths; |
This file contains 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/constraint; | |
// Constraint on the `int` type. | |
@constraint:Int { | |
minValue: 18 | |
} | |
type Age int; | |
type Student record {| | |
// Constraint on the `string`-typed record field. |
This file contains 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 ballerina/xmldata; | |
// Defines a record type with annotations. | |
@xmldata:Namespace { | |
prefix: "ns", | |
uri: "http://sdf.com" | |
} | |
type Invoice record { | |
int id; |
This file contains 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 ballerina/xmldata; | |
// Defines a record type with annotations. | |
@xmldata:Namespace { | |
prefix: "ns", | |
uri: "http://sdf.com" | |
} | |
type Invoice record { | |
int id; |
NewerOlder