jsonnode

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package jsonnode 提供从上下文或 JSON 对象中提取字段的默认 node 节点。

Index

Constants

View Source
const NodeType = "json.extract"

Variables

This section is empty.

Functions

func Definition

func Definition() node.Definition

Definition 返回 JSON 提取节点的完整注册定义。

func SourceRoot

func SourceRoot(fc *core.FlowContext, path string) (interface{}, bool)

SourceRoot 从固定入口 ctx 按点分路径读取数据,例如 ctx.params.id 或 ctx.vars.user.name。

Types

type Config

type Config struct {
	Path         string            `json:"path"`
	Mappings     map[string]string `json:"mappings"`
	MissingAsNil bool              `json:"missingAsNil"`
}

Config 是 JSON node 从 node.config 解码得到的内部配置。

func DefaultConfig

func DefaultConfig() *Config

type Node

type Node struct{}

Node 从 FlowContext 的固定 ctx 入口按路径提取字段,并返回提取结果。

func NewNode

func NewNode() *Node

func (*Node) Execute

func (e *Node) Execute(fc *core.FlowContext, node *core.NodeDefine) (interface{}, error)

Jump to

Keyboard shortcuts

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