generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(lsp): more completions. fix bug with completions.
Completions were sometimes not being triggering correctly.
- Loading branch information
Showing
16 changed files
with
226 additions
and
13 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for declaring a config variable. | ||
|
||
```go | ||
var defaultUser = ftl.Config[string]("default") | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/ | ||
--- | ||
var ${1:configVar} = ftl.Config[${2:Type}](${3:default}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for getting a config variable. | ||
|
||
```go | ||
username = defaultUser.Get(ctx) | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/ | ||
--- | ||
${1:value} := ${2:configVar}.Get(ctx) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Snippet for declaring a cron job. | ||
|
||
```go | ||
//ftl:cron 0 * * * * | ||
func Hourly(ctx context.Context) {} | ||
|
||
//ftl:cron 6h | ||
func EverySixHours(ctx context.Context) {} | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/cron/ | ||
--- | ||
|
||
//ftl:cron ${1:Schedule} | ||
func ${2:Name}(ctx context.Context) { | ||
${3:// TODO: Implement} | ||
} | ||
``` |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Snippet for declaring an ingress function. | ||
|
||
```go | ||
type GetRequest struct { | ||
UserID string `json:"userId"` | ||
PostID string `json:"postId"` | ||
} | ||
|
||
type GetResponse struct { | ||
Message string `json:"msg"` | ||
} | ||
|
||
//ftl:ingress GET /http/users/{userId}/posts | ||
func Get(ctx context.Context, req builtin.HttpRequest[GetRequest]) (builtin.HttpResponse[GetResponse, string], error) { | ||
return builtin.HttpResponse[GetResponse, string]{ | ||
Status: 200, | ||
Body: ftl.Some(GetResponse{}), | ||
}, nil | ||
} | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/ingress/ | ||
--- | ||
type ${1:Func}Request struct { | ||
${2:Field} ${3:Type} `json:"${4:field}"` | ||
} | ||
|
||
type ${1:Func}Response struct { | ||
${5:Field} ${6:Type} `json:"${7:field}"` | ||
} | ||
|
||
//ftl:ingress ${8:GET} ${9:/url/path} | ||
func ${1:Func}(ctx context.Context, req builtin.HttpRequest[${1:Func}Request]) (builtin.HttpResponse[${1:Func}Response, string], error) { | ||
${7:// TODO: Implement} | ||
return builtin.HttpResponse[${1:Func}Response, string]{ | ||
Status: 200, | ||
Body: ftl.Some(${1:Func}Response{}), | ||
}, nil | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Snippet for publishing an event to a topic. | ||
|
||
```go | ||
invoicesTopic.Publish(ctx, Invoice{...}) | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/pubsub/ | ||
--- | ||
${1:topicVar}.Publish(ctx, ${2:Type}{${3:...}}) | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Snippet for a sink function that consume events from a PubSub subscription. | ||
|
||
```go | ||
//ftl:subscribe emailInvoices | ||
func SendInvoiceEmail(ctx context.Context, in Invoice) error { | ||
// ... | ||
} | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/pubsub/ | ||
--- | ||
//ftl:subscribe ${1:subscriptionName} | ||
func ${2:FunctionName}(ctx context.Context, in ${3:Type}) error { | ||
${4:// TODO: Implement} | ||
return nil | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for declaring a subscription to a topic. | ||
|
||
```go | ||
var _ = ftl.Subscription(invoicesTopic, "emailInvoices") | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/pubsub/ | ||
--- | ||
var _ = ftl.Subscription(${1:topicVar}, "${2:subscriptionName}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for declaring a topic. | ||
|
||
```go | ||
var invoicesTopic = ftl.Topic[Invoice]("invoices") | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/pubsub/ | ||
--- | ||
var ${1:topicVar} = ftl.Topic[${2:Type}]("${1:topicName}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for retrying an async operation. | ||
|
||
```go | ||
//ftl:retry [<attempts>] <min-backoff> [<max-backoff>] | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/retries/ | ||
--- | ||
//ftl:retry ${1:attempts} ${2:minBackoff} ${3:maxBackoff} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for declaring a secret. | ||
|
||
```go | ||
var apiKey = ftl.Secret[string]("apiKey") | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/ | ||
--- | ||
var ${1:secretVar} = ftl.Secret[${2:Type}](${3:default}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Snippet for getting a secret. | ||
|
||
```go | ||
apiValue := apiKey.Get(ctx) | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/ | ||
--- | ||
${1:value} := ${2:secretVar}.Get(ctx) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Snippet for declaring a type alias. | ||
|
||
```go | ||
//ftl:typealias | ||
type UserID string | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/types/ | ||
--- | ||
//ftl:typealias | ||
type ${1:Alias} ${2:Type} | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
Snippet for defining a verb function. | ||
Snippet for declaring a verb function. | ||
|
||
```go | ||
//ftl:verb | ||
func Name(ctx context.Context, req Request) (Response, error) {} | ||
``` | ||
|
||
See https://tbd54566975.github.io/ftl/docs/reference/verbs/ | ||
--- | ||
type ${1:Request} struct {} | ||
type ${2:Response} struct {} | ||
|
||
//ftl:verb | ||
func ${3:Name}(ctx context.Context, req ${1:Request}) (${2:Response}, error) { | ||
return ${2:Response}{}, nil | ||
${4:// TODO: Implement} | ||
return ${2:Response}{}, nil | ||
} |