Documentation
¶
Overview ¶
Package nodes_sequence provides bounded sequence-generation actions.
Typical use:
sequence.range(start: 7, count: 4)
Index ¶
Constants ¶
View Source
const ID = "nodes_sequence"
Variables ¶
View Source
var RangeAction = action.New("sequence.range", func(_ context.Context, req RangeReq) ([]int, error) { if req.Count == nil { return nil, xerr.BadRequest("sequence.range: count is required") } count := *req.Count if count < 0 { return nil, xerr.BadRequest("sequence.range: count must be zero or greater") } if count > maxRangeCount { return nil, xerr.BadRequest(fmt.Sprintf("sequence.range: count %d exceeds limit of %d", count, maxRangeCount)) } if count > 0 && req.Start > math.MaxInt-(count-1) { return nil, xerr.BadRequest("sequence.range: final value overflows int") } values := make([]int, count) for i := range values { values[i] = req.Start + i } return values, nil }).Description("Generate a bounded list of consecutive integers").Tag("sequence", "range").Build()
RangeAction returns Count integers beginning at Start, with an exclusive upper bound. The output is bounded to keep callers from allocating an unbounded fan-out batch.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.