Skip to content

Commit

Permalink
Describe common use case for raw templates
Browse files Browse the repository at this point in the history
  • Loading branch information
heshanpadmasiri committed Oct 29, 2024
1 parent 5ac3aeb commit 7bea092
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/raw-templates/raw_templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ Raw template expressions are backtick templates without a tag (such as `string`

If you want to control the type of the strings or the interpolations more precisely, you can define an object type that includes the `object:RawTemplate` type and override the relevant field(s) with narrower types. Then, the compiler will statically validate the values against the expected type(s).

A common use case for raw templates is to create SQL queries.

::: code raw_templates.bal :::

::: out raw_templates.out :::

## Related links
- [Backtick templates](https://ballerina.io/learn/by-example/backtick-templates/)
- [Object type inclusion](https://ballerina.io/learn/by-example/object-type-inclusion/)
- [Database Access - Simple query](https://ballerina.io/learn/by-example/mysql-query-operation/)

0 comments on commit 7bea092

Please sign in to comment.