MCPcopy
hub / github.com/micro/go-micro / counter

Function counter

flow/loop_test.go:10–16  ·  view source on GitHub ↗

counter body: increments an integer carried in State.Data.

()

Source from the content-addressed store, hash-verified

8
9// counter body: increments an integer carried in State.Data.
10func counter() StepFunc {
11 return func(ctx context.Context, in State) (State, error) {
12 n, _ := strconv.Atoi(in.String())
13 in.Data = []byte(strconv.Itoa(n + 1))
14 return in, nil
15 }
16}
17
18func TestLoopUntil(t *testing.T) {
19 step := Loop(counter(),

Callers 1

TestLoopUntilFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…