- Binding patterns
- Typed binding pattern
- Wildcard binding pattern
- List binding patterns
- Rest binding pattern in list binding pattern
- Mapping binding pattern
- Rest binding pattern in mapping binding pattern
- Error binding pattern
- Rest binding pattern in error binding pattern
- Single use of typed binding patterns
- Single use of typed binding patterns with on fail clause
- Iterative use of typed binding patterns
- List binding pattern in match statement
- Mapping binding pattern in match statement
- Error binding pattern in match statement
- Query expressions
- Sort iterable objects
- Let clause
- Limit clause
- Join iterable objects
- Outer Join clause
- Query tables
- Create tables with a query
- Create maps with a query
- Create streams with a query
- On conflict clause
- Iterate over XML with a query
- Nested query expressions
- Destructure records using a query
- Querying streams
- Aggregation
- JSON type
- Access JSON elements
- Access optional JSON elements
- Match statement with maps
- Convert from user-defined type to JSON
- Convert from table and XML to JSON
- Convert from JSON to user-defined type
- Cast JSON to user-defined type
- Resource method typing
- JSON numbers
- JSON to record
- JSON to record with projection
- JSONPath expressions
- Asynchronous function calls
- Named workers
- Sequence diagrams
- Wait for workers
- Strands
- Named worker return values
- Alternate wait
- Multiple wait
- Named workers and futures
- Inter-worker message passing
- Conditional send
- Inter-worker failure propagation
- Named worker with on fail clause
- Synchronize message passing
- Asynchronize message passing
- Flush
- Fork
Ballerina By Example
Ballerina by Example enables you to have complete coverage over the language, while emphasizing incremental learning. This is a series of commented example programs.
Language concepts
- Hello World
- Hello world main
- Hello world service
- Simple basic types
- Integers
- Floating point numbers
- Decimal type
- Nil
- Boolean
- Byte type
- Strings
- Strings
- Operators
- Binary operators
- Unary operators
- Conditional statements
- If statement
- Match statement
- Match guard in match statement
- Binding patterns in match statement
- Functions
- Functions
- Included record parameters
- Rest parameters
- Default values for function parameters
- Provide function arguments by name
- Function pointers
- Function values
- Function types
- Anonymous function
- Function closure
- Lang library
- Langlib functions
- Types and typing
- Structural typing
- Unions
- Errors
- Anydata type
- Any type
- Type definitions
- Typedesc type
- Covariance
- Type inference
- Built-in integer subtypes
- Built-in string subtype
- ensureType function
- Dependent types
- Stream type
- Never type
- Expression-oriented style
- Expression-oriented style
- Equality
- Expression equality
- Mappings
- Maps
- Records
- Computed field key
- Records
- Optional fields
- Open records
- Controlling openness
- Type inclusion for records
- Default values for record fields
- Array/Map symmetry
- Array/Map symmetry
- Objects
- Object
- Defining classes
- Object constructor
- Object value from class definition
- Visibility of object fields and methods
- Init return type
- Object types
- Object type inclusion
- Distinct object types
- Object closure
- Client class
- Start service from service class definition
- Binding patterns
- Binding patterns
- Typed binding pattern
- Wildcard binding pattern
- List binding patterns
- Rest binding pattern in list binding pattern
- Mapping binding pattern
- Rest binding pattern in mapping binding pattern
- Error binding pattern
- Rest binding pattern in error binding pattern
- Single use of typed binding patterns
- Single use of typed binding patterns with on fail clause
- Iterative use of typed binding patterns
- List binding pattern in match statement
- Mapping binding pattern in match statement
- Error binding pattern in match statement
- Query expressions
- Query expressions
- Sort iterable objects
- Let clause
- Limit clause
- Join iterable objects
- Outer Join clause
- Query tables
- Create tables with a query
- Create maps with a query
- Create streams with a query
- On conflict clause
- Iterate over XML with a query
- Nested query expressions
- Destructure records using a query
- Querying streams
- Aggregation
- Query actions
- Query actions
- JSON
- JSON type
- Access JSON elements
- Access optional JSON elements
- Match statement with maps
- Convert from user-defined type to JSON
- Convert from table and XML to JSON
- Convert from JSON to user-defined type
- Cast JSON to user-defined type
- Resource method typing
- JSON numbers
- JSON to record
- JSON to record with projection
- JSONPath expressions
- Backtick templates
- Raw templates
- Backtick templates
- XML templates
- XML
- XML data model
- XML operations
- XML iteration
- XML access
- XML mutation
- XML subtyping
- XML navigation
- XML templates and query
- XML namespaces
- XMLNS declarations
- XML to record
- XML to record with projection
- Regular Expressions
- RegExp type
- RegExp operations
- Metadata
- Documentation
- Annotations
- Network interaction
- Consume services: client objects
- Provide services
- Module lifecycle
- Service declaration
- Resource methods
- Hierarchical resources
- Resource path parameters
- Error handling
- Error handling
- Check expression
- Error subtyping
- Panics
- Type intersection for error types
- Error detail
- Error cause
- Ignore return values and errors
- Ignore return values and errors
- Mutability and identity
- Identity
- Const and final
- Enumerations
- Immutability
- Concurrency
- Asynchronous function calls
- Named workers
- Sequence diagrams
- Wait for workers
- Strands
- Named worker return values
- Alternate wait
- Multiple wait
- Named workers and futures
- Inter-worker message passing
- Conditional send
- Inter-worker failure propagation
- Named worker with on fail clause
- Synchronize message passing
- Asynchronize message passing
- Flush
- Fork
- Transactions
- Transaction statement
- Check semantics
- Rollback
- Retry transaction statement
- Transactional qualifier
- Transactional named workers
- Commit/rollback handlers
- Concurrency safety
- Lock statement
- Isolated functions
- Readonly type
- Readonly and isolated
- Readonly objects and classes
- Combining isolated functions and lock
- Isolated variables
- Isolated methods
- Isolated objects
- Inferring isolated
- Run strands safely on separate threads
- Interface to external code
- Interface to external code
Network libraries
- REST service
- Basic REST service
- Service and resource paths
- Payload data binding
- Payload constraint validation
- Path parameter
- Query parameter
- Header parameter
- Send response
- Send different status codes
- Send different status codes with payload
- Error handling
- Send cache response
- HTTP client
- Send request/Receive response
- Payload data binding
- Payload constraint validation
- Path parameter
- Query parameter
- Header parameter
- Enable caching
- REST service security
- SSL/TLS
- Mutual SSL
- Basic authentication file user store
- Basic authentication LDAP user store
- JWT authentication
- OAuth2
- HTTP client security
- SSL/TLS
- Mutual SSL
- Basic authentication
- Bearer token authentication
- Self-signed JWT authentication
- OAuth2 client credentials grant type
- OAuth2 password grant type
- OAuth2 refresh token grant type
- OAuth2 JWT bearer grant type
- HTTP client resiliency
- Timeout
- Retry
- Circuit breaker
- Load balancer
- Failover
- HTTP service advanced
- Default resource
- Request/Response object
- Caller object
- Redirects
- CORS
- 100 continue
- Matrix parameter
- Restrict by media type
- File upload
- Compression
- Trace logs
- Access logs
- Cookies
- Chunking
- Sending headers
- Response with multiparts
- Passthrough
- HTTP/2 to HTTP/1.1 downgrade
- HTTP/2 server push
- Server-sent events
- HTTP client advanced
- Redirects
- File upload
- Cookies
- Chunking
- Request with multiparts
- HTTP/2 to HTTP/1.1 downgrade
- HTTP/2 prior knowledge
- HTTP/2 server push
- Server-sent events
- HTTP service interceptors
- Request interceptor
- Response interceptor
- Error handling
- Interceptor error handling
- GraphQL service
- Hello world
- Service as output object
- Record as output object
- Input types
- Mutations
- Subscriptions
- Input objects
- ID scalar type
- Interfaces
- Interfaces implementing interfaces
- Union types
- Error handling
- GraphiQL client
- Documentation
- Directives
- Hierarchical resource paths
- GraphQL service advanced
- Context object
- Field object
- Service interceptors
- Field interceptors
- Interceptor configurations
- Input constraint validation
- File upload
- Dataloader
- Custom prefetch methods
- Operation-level caching
- Field-level caching
- Cache invalidation
- Query Complexity
- GraphQL service security
- SSL/TLS
- Mutual SSL
- Basic authentication file user store
- Basic authentication LDAP user store
- JWT authentication
- OAuth2
- GraphQL client security
- SSL/TLS
- Mutual SSL
- Basic authentication
- Self-signed JWT authentication
- OAuth2 password grant type
- WebSocket service
- Send/Receive message
- Payload constraint validation
- Error handling
- WebSocket client
- Send/Receive message
- Payload constraint validation
- WebSocket service security
- SSL/TLS
- Mutual SSL
- Basic authentication file user store
- Basic authentication LDAP user store
- JWT authentication
- OAuth2
- WebSocket client security
- SSL/TLS
- Mutual SSL
- Basic authentication
- Bearer token authentication
- Self-signed JWT authentication
- OAuth2 client credentials grant type
- OAuth2 password grant type
- OAuth2 refresh token grant type
- OAuth2 JWT bearer grant type
- WebSub service
- Consume github events
- Listeners and StopHandlers
- Dynamic listener
- StopHandler
- gRPC service
- Simple RPC
- Server-side streaming RPC
- Client-side streaming RPC
- Bidirectional streaming RPC
- Send/Receive headers
- Server reflection
- Check deadline
- gRPC client
- Simple RPC
- Server-side streaming RPC
- Client-side streaming RPC
- Bidirectional streaming RPC
- Send/Receive headers
- Set deadline
- gRPC service security
- SSL/TLS
- Mutual SSL
- Basic authentication file user store
- Basic authentication LDAP user store
- JWT authentication
- OAuth2
- gRPC client security
- SSL/TLS
- Mutual SSL
- Basic authentication
- Bearer token authentication
- Self-signed JWT authentication
- OAuth2 client credentials grant type
- OAuth2 password grant type
- OAuth2 refresh token grant type
- OAuth2 JWT bearer grant type
- NATS service
- Consume message
- Send reply to request message
- Constraint validations
- Consume JetStream message
- NATS service security
- SSL/TLS
- Basic authentication
- NATS client security
- SSL/TLS
- Basic authentication
- Kafka service
- Consume message
- Constraint validation
- Error handling
- Kafka producer
- Produce message
- Kafka service security
- SSL/TLS
- SASL authentication
- Kafka producer security
- SSL/TLS
- SASL authentication
- Kafka consumer security
- SSL/TLS
- SASL authentication
- SOAP client
- Send/Receive
- SOAP client security
- SSL/TLS
- Inbound Security
- Outbound Security
- RabbitMQ service
- Consume message
- Consume message with acknowledgement
- Transactional consumer
- Constraint validation
- RabbitMQ client
- Declare a queue
- Produce message
- Consume message
- Transactional producer
- Constraint validation
- RabbitMQ service security
- SSL/TLS
- Basic authentication
- RabbitMQ client security
- SSL/TLS
- Basic authentication
- MQTT service
- Subscribe to messages
- MQTT client
- Publish message
- MQTT service security
- SSL/TLS
- Basic authentication
- MQTT client security
- SSL/TLS
- Basic authentication
- LDAP client
- Add/Remove entries
- Search for an entry
- JMS service
- Consume message
- JMS message producer
- Produce message
- Transactions
- JMS message consumer
- Consume message
- Manual acknowledgment
- TCP service
- Send/Receive bytes
- TCP client
- Send/Receive bytes
- TCP service security
- SSL/TLS
- TCP client security
- SSL/TLS
- UDP service
- Send/Receive datagram
- Email service
- Receive email
- Email client
- Send email
- Receive email
- Email service security
- SSL/TLS
- Email client security
- SSL/TLS
- FTP Service
- Receive file
- Send file
- FTP client
- Receive file
- Send file
- SFTP Service
- Receive file
- Send file
- SFTP client
- Receive file
- Send file
Common libraries
- Random
- Random numbers
- XML data
- XML to JSON conversion
- JSON to XML conversion
- XML to record conversion
- Record to XML conversion
- CSV data
- Convert CSV string to records
- Convert CSV string to arrays
- Parse CSV byte streams to records
- Parse CSV lists to custom types
- Transform CSV records to custom types
- Handle CSV with custom configurations
- Constraint
- Constraint validations
Deployment
- Docker
- Hello world
- Kubernetes
- Hello world
Bal persist
- Write data
- Create/Create many
- Update
- Delete