{"modulePath":"github.com/dracory/nodebase","version":"v0.8.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package rangenode\n\nPackage rangenode contains the range node implementation.\n\n## Types\n\n```go\ntype RangeConfig struct {\n\t// Action is \"scale\" (default, extrapolate freely), \"drop\"\n\t// (discard out-of-range messages), \"clamp\" (clamp to the input\n\t// range) or \"roll\" (wrap into the input range)\n\tAction string `json:\"action\"`\n\t// Property is the dotted path into the payload; \"payload\" (the\n\t// default) targets the whole payload\n\tProperty string  `json:\"property\"`\n\tMinIn    float64 `json:\"minin\"`\n\tMaxIn    float64 `json:\"maxin\"`\n\tMinOut   float64 `json:\"minout\"`\n\tMaxOut   float64 `json:\"maxout\"`\n\t// Round rounds the scaled result to the nearest integer\n\tRound bool `json:\"round\"`\n}\n```\nRangeConfig holds configuration for the range node — the Node-RED range equivalent. MinIn/MaxIn define the input range, MinOut/MaxOut the output range the value is linearly mapped to.\n\n```go\ntype RangeNode struct {\n\t*nodebase.BaseNode\n\t// contains filtered or unexported fields\n}\n```\nRangeNode linearly maps a numeric payload property from an input range to an output range, with an optional out-of-range action applied to the input range before scaling.\n\n```go\nfunc NewRangeNode(node nodestore.NodeInterface, config *RangeConfig) *RangeNode\n```\nNewRangeNode creates a new range node\n\n```go\nfunc (n *RangeNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)\n```\nExecute reads the configured property, applies the out-of-range action, scales the value and writes it back. A non-numeric value or a value dropped by the \"drop\" action ends the message here (nil output); a missing property passes the message through unchanged.\n\n","path":"github.com/dracory/nodebase/range","name":"rangenode","synopsis":"Package rangenode contains the range node implementation.","isRedistributable":true}
