codec

package
v1.11.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCenterSpec

func BuildCenterSpec[T any](name string, modelUID string) (types.ResourceSpec, error)

BuildCenterSpec 基于中心节点模型结构 T 反射构建出根 ResourceSpec

func DecodeResource

func DecodeResource[T any](resource types.ResolvedResource) (T, error)

DecodeResource 将已解析资源按照 `plugin` tag 解码成强类型结构 T

func DeriveSchema

func DeriveSchema[T any](modelUID string) (types.Schema, error)

DeriveSchema 基于泛型结构体 T 与入口 modelUID,自动推导最小合法的 CMDB 元数据 Schema

func InputMany

func InputMany[T any](actionCtx types.ActionContext, name string) ([]T, error)

InputMany 从动作上下文中读取多个输入,并逐个解码成调用方声明的强类型结构 T

func InputOne

func InputOne[T any](actionCtx types.ActionContext, name string) (T, error)

InputOne 从动作上下文中读取单个输入,并解码成调用方声明的强类型结构 T

func InputRootOne

func InputRootOne[T any](actionCtx types.ActionContext) (T, error)

InputRootOne 自动定位入口输入并解码为目标结构体 T

func RootInputName

func RootInputName(actionCtx types.ActionContext) (string, error)

RootInputName 自动推断根节点输入名称

Types

type CompactModelDescriptor added in v1.11.4

type CompactModelDescriptor interface {
	DescribeModel() (name string, group string)
}

CompactModelDescriptor 允许模型结构体通过单方法自描述中文名称与所属模型分组

type IEnum added in v1.11.6

type IEnum interface {
	EnumOptions() []string
}

IEnum 允许属性字段类型通过实现该接口自描述其合法枚举选项列表

type ModelDescriptor added in v1.11.4

type ModelDescriptor interface {
	ModelName() string
	ModelGroup() string
}

ModelDescriptor 允许模型结构体自描述其中文名称与所属模型分组

type ModelGroupDescriptor added in v1.11.4

type ModelGroupDescriptor interface {
	ModelGroup() string
}

ModelGroupDescriptor 允许模型结构体仅自描述其所属模型分组

type ModelNameDescriptor added in v1.11.4

type ModelNameDescriptor interface {
	ModelName() string
}

ModelNameDescriptor 允许模型结构体仅自描述其中文展示名称

type TargetMeta added in v1.11.4

type TargetMeta struct {
	Schema types.Schema
	Spec   types.ResourceSpec
}

TargetMeta 包含目标资产经过一次内省推导产出的 Schema 和 ResourceSpec

func InspectTarget added in v1.11.4

func InspectTarget[T any](name string, modelUID string) (TargetMeta, error)

InspectTarget 基于目标资产泛型 T 完成单次内省与双向投影,零冗余分支

Jump to

Keyboard shortcuts

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