mirror of https://github.com/dapr/docs.git
Merge branch 'v1.13' into issue_3704
This commit is contained in:
commit
735029f345
|
@ -211,7 +211,7 @@ const randomString = getRandomString();
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
const currentTime = time.Now()
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
@ -254,13 +254,12 @@ const randomString = yield context.callActivity(getRandomString);
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
const currentTime = ctx.CurrentUTCDateTime()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
@ -319,10 +318,12 @@ fetch('https://postman-echo.com/get')
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
resp, err := http.Get("http://example.com/api/data")
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
Do this:
|
Do this:
|
||||||
|
@ -364,6 +365,8 @@ const data = yield ctx.callActivity(makeHttpCall, "https://example.com/api/data"
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
// Do this!!
|
||||||
|
err := ctx.CallActivity(MakeHttpCallActivity, workflow.ActivityInput("https://example.com/api/data")).Await(&output)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
@ -412,9 +415,16 @@ Don't declare JavaScript workflow as `async`. The Node.js runtime doesn't guaran
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
go func() {
|
||||||
|
err := ctx.CallActivity(DoSomething).Await(nil)
|
||||||
|
}()
|
||||||
|
err := ctx.CreateTimer(time.Second).Await(nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
Do this:
|
Do this:
|
||||||
|
@ -450,7 +460,9 @@ Since the Node.js runtime doesn't guarantee that asynchronous functions are dete
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
// Do this!
|
||||||
|
task := ctx.CallActivity(DoSomething)
|
||||||
|
task.Await(nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
@ -489,4 +501,4 @@ To work around these constraints:
|
||||||
- [JavaScript](https://github.com/dapr/js-sdk/tree/main/examples/workflow)
|
- [JavaScript](https://github.com/dapr/js-sdk/tree/main/examples/workflow)
|
||||||
- [.NET](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
- [.NET](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
||||||
- [Java](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows)
|
- [Java](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows)
|
||||||
- [Go](https://github.com/dapr/go-sdk/tree/main/examples/workflow/README.md)
|
- [Go](https://github.com/dapr/go-sdk/tree/main/examples/workflow/README.md)
|
||||||
|
|
Loading…
Reference in New Issue