fix: README
This commit is contained in:
parent
502b8cefc1
commit
afa90e9839
1 changed files with 158 additions and 158 deletions
132
README.md
132
README.md
|
@ -26,52 +26,52 @@ zig build
|
|||
<details>
|
||||
<summary>Python</summary>
|
||||
|
||||
```python
|
||||
from typing import Union
|
||||
```python
|
||||
from typing import Union
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {"Hello": "World"}
|
||||
|
||||
|
||||
@app.get("/items/{item_id}")
|
||||
def read_item(item_id: int, q: Union[str, None] = None):
|
||||
@app.get("/items/{item_id}")
|
||||
def read_item(item_id: int, q: Union[str, None] = None):
|
||||
return {"item_id": item_id, "q": q}
|
||||
```
|
||||
```
|
||||
|
||||
Result:
|
||||
Result:
|
||||
|
||||
```
|
||||
File: test.py
|
||||
Language: python
|
||||
```
|
||||
File: test.py
|
||||
Language: python
|
||||
|
||||
var app = FastAPI();
|
||||
func read_root() -> void;
|
||||
func read_item() -> void;
|
||||
```
|
||||
var app = FastAPI();
|
||||
func read_root() -> void;
|
||||
func read_item() -> void;
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Zig</summary>
|
||||
|
||||
```zig
|
||||
const std = @import("std");
|
||||
```zig
|
||||
const std = @import("std");
|
||||
|
||||
const root = @import("root.zig");
|
||||
const E = root.E;
|
||||
const P3 = root.P3;
|
||||
const Vec3 = root.Vec3;
|
||||
const Sphere = root.Sphere;
|
||||
const Ray = root.Ray;
|
||||
const Interval = root.Interval;
|
||||
const root = @import("root.zig");
|
||||
const E = root.E;
|
||||
const P3 = root.P3;
|
||||
const Vec3 = root.Vec3;
|
||||
const Sphere = root.Sphere;
|
||||
const Ray = root.Ray;
|
||||
const Interval = root.Interval;
|
||||
|
||||
pub const Hittable = union(enum) {
|
||||
pub const Hittable = union(enum) {
|
||||
const Self = @This();
|
||||
sphere: Sphere,
|
||||
|
||||
|
@ -99,47 +99,47 @@ zig build
|
|||
inline else => |hittable| return hittable.collisionAt(interval, ray),
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
};
|
||||
```
|
||||
|
||||
Result:
|
||||
Result:
|
||||
|
||||
```
|
||||
File: /Users/bogdanbuduroiu/development/bruvduroiu/raytracing.zig/src/hittable.zig
|
||||
Language: zig
|
||||
```
|
||||
File: /Users/bogdanbuduroiu/development/bruvduroiu/raytracing.zig/src/hittable.zig
|
||||
Language: zig
|
||||
|
||||
var t;
|
||||
var p;
|
||||
var normal;
|
||||
var face;
|
||||
```
|
||||
var t;
|
||||
var p;
|
||||
var normal;
|
||||
var face;
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Go</summary>
|
||||
|
||||
```go
|
||||
package batch_sliding_window
|
||||
```go
|
||||
package batch_sliding_window
|
||||
|
||||
import (
|
||||
import (
|
||||
"fmt"
|
||||
"go.temporal.io/sdk/temporal"
|
||||
"go.temporal.io/sdk/workflow"
|
||||
"time"
|
||||
)
|
||||
)
|
||||
|
||||
// ProcessBatchWorkflowInput input of the ProcessBatchWorkflow.
|
||||
// A single input structure is preferred to multiple workflow arguments to simplify backward compatible API changes.
|
||||
type ProcessBatchWorkflowInput struct {
|
||||
// ProcessBatchWorkflowInput input of the ProcessBatchWorkflow.
|
||||
// A single input structure is preferred to multiple workflow arguments to simplify backward compatible API changes.
|
||||
type ProcessBatchWorkflowInput struct {
|
||||
PageSize int // Number of children started by a single sliding window workflow run
|
||||
SlidingWindowSize int // Maximum number of children to run in parallel.
|
||||
Partitions int // How many sliding windows to run in parallel.
|
||||
}
|
||||
}
|
||||
|
||||
// ProcessBatchWorkflow sample Partitions the data set into continuous ranges.
|
||||
// A real application can choose any other way to divide the records into multiple collections.
|
||||
func ProcessBatchWorkflow(ctx workflow.Context, input ProcessBatchWorkflowInput) (processed int, err error) {
|
||||
// ProcessBatchWorkflow sample Partitions the data set into continuous ranges.
|
||||
// A real application can choose any other way to divide the records into multiple collections.
|
||||
func ProcessBatchWorkflow(ctx workflow.Context, input ProcessBatchWorkflowInput) (processed int, err error) {
|
||||
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
|
||||
StartToCloseTimeout: 5 * time.Second,
|
||||
})
|
||||
|
@ -196,9 +196,9 @@ zig build
|
|||
result += r
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
}
|
||||
|
||||
func divideIntoPartitions(number int, n int) []int {
|
||||
func divideIntoPartitions(number int, n int) []int {
|
||||
base := number / n
|
||||
remainder := number % n
|
||||
partitions := make([]int, n)
|
||||
|
@ -212,22 +212,22 @@ zig build
|
|||
}
|
||||
|
||||
return partitions
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
Result:
|
||||
Result:
|
||||
|
||||
```
|
||||
File: /Users/bogdanbuduroiu/development/temporalio/samples-go/batch-
|
||||
sliding-window/batch_workflow.go
|
||||
Language: go
|
||||
```
|
||||
File: /Users/bogdanbuduroiu/development/temporalio/samples-go/batch-
|
||||
sliding-window/batch_workflow.go
|
||||
Language: go
|
||||
|
||||
class ProcessBatchWorkflowInput {
|
||||
};
|
||||
var PageSize;
|
||||
var SlidingWindowSize;
|
||||
var Partitions;
|
||||
func ProcessBatchWorkflow() -> void;
|
||||
func divideIntoPartitions() -> void;
|
||||
```
|
||||
class ProcessBatchWorkflowInput {
|
||||
};
|
||||
var PageSize;
|
||||
var SlidingWindowSize;
|
||||
var Partitions;
|
||||
func ProcessBatchWorkflow() -> void;
|
||||
func divideIntoPartitions() -> void;
|
||||
```
|
||||
</details>
|
||||
|
|
Loading…
Add table
Reference in a new issue