Skip to content

Commit

Permalink
docs: move language-specific visibility docs into respective tabs (#2950
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alecthomas authored Oct 2, 2024
1 parent 4346c40 commit 3656949
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions docs/content/docs/reference/visibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Exporting a declaration makes it accessible to other modules. Some declarations

Types that are transitively referenced by an exported declaration will be automatically exported unless they were already defined but unexported. In this case, an error will be raised and the type must be explicitly exported.


{% code_selector() %}

<!-- go -->

The following table describes the go directives used to export the corresponding declaration:

| Symbol | Export syntax |
Expand All @@ -30,30 +35,31 @@ The following table describes the go directives used to export the corresponding
| Enum/Sum type | `//ftl:enum export` |
| Typealias | `//ftl:typealias export` |
| Topic | `//ftl:export` [^1] |

For JVM languages the `@Export` annotation can be used to export a declaration.

eg.

{% code_selector() %}

<!-- go -->
```go
//ftl:verb export
func Verb(ctx context.Context, in In) (Out, error)

//ftl:typealias export
type UserID string
```

[^1]: By default, topics do not require any annotations as the declaration itself is sufficient.

<!-- kotlin -->
```kotlin

For Kotlin the `@Export` annotation can be used to export a declaration:

```kotlin
@Verb
@Export
fun time(): TimeResponse {
// ...
}
```
<!-- java -->

For Java the `@Export` annotation can be used to export a declaration:

```java
@Verb
@Export
Expand All @@ -62,5 +68,3 @@ TimeResponse time() {
}
```
{% end %}

[^1]: By default, topics do not require any annotations as the declaration itself is sufficient.

0 comments on commit 3656949

Please sign in to comment.