Returns true when Min ≤ Value ≤ Max (inclusive range check).
| Field | Type | Description |
|---|---|---|
Value | *float64 | Value to test |
Min | *float64 | Lower bound (inclusive) |
Max | *float64 | Upper bound (inclusive) |
| Field | Type | Description |
|---|---|---|
Match | bool | True when Min ≤ Value ≤ Max |
Checks whether a confidence score of 0.72 falls within the medium-confidence band of 0.5–0.9.
package main
import (
"context"
"encoding/json"
"log"
"os"
"time"
"github.com/akennis/sparsi-go/library"
_ "github.com/akennis/dagor/operator/builtin"
"github.com/panjf2000/ants/v2"
"github.com/akennis/dagor"
"github.com/akennis/dagor/graph"
)
func main() {
score, lo, hi := 0.72, 0.5, 0.9
library.RegisterConst("score_val", score)
library.RegisterConst("lo_val", lo)
library.RegisterConst("hi_val", hi)
g, err := graph.NewBuilder("between_demo").
Vertex("src_v").Op("score_val").Output("Result", "wire_v").
Vertex("src_lo").Op("lo_val").Output("Result", "wire_lo").
Vertex("src_hi").Op("hi_val").Output("Result", "wire_hi").
Vertex("check").Op("BetweenFloatOp").
Input("Value", "wire_v").
Input("Min", "wire_lo").
Input("Max", "wire_hi").
Output("Match", "in_range").
Build()
if err != nil {
log.Fatalf("build: %v", err)
}
pool, err := ants.NewPool(4)
if err != nil {
log.Fatalf("pool: %v", err)
}
defer pool.Release()
eng, err := dagor.NewEngine(g, pool)
if err != nil {
log.Fatalf("engine: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
if err := eng.Run(ctx); err != nil {
log.Fatalf("run: %v", err)
}
out := map[string]any{"score": score, "min": lo, "max": hi}
if raw, ok := eng.GetOutput("in_range"); ok {
out["in_range"] = *raw.(*bool)
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
enc.Encode(out)
}