nodes_sequence

package
v0.111.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Bundle

func Bundle(_ map[string]string) compiler.Bundle

func Library

func Library() action.Library

Types

type RangeReq

type RangeReq struct {
	Start int  `json:"start,omitempty"`
	Count *int `json:"count" validate:"required"`
}

RangeReq describes a consecutive integer sequence. Count is a pointer so the action can distinguish an omitted count from an explicitly empty range.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL