codec

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 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 BuildSpecs

func BuildSpecs[T any]() ([]types.ResourceSpec, error)

BuildSpecs 基于顶层输入容器 T 反射解析出 types.ResourceSpec 列表

func DecodeResource

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

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

func DeriveSchema

func DeriveSchema[T any](modelUID string, opts ...DeriveOption) (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 DeriveOption added in v1.11.3

type DeriveOption func(*deriveOptions)

DeriveOption 用于向 DeriveSchema 传入模型级别的元数据覆写选项

func WithModelGroup added in v1.11.3

func WithModelGroup(group string) DeriveOption

WithModelGroup 设置根模型所属的 CMDB 模型分组

func WithModelName added in v1.11.3

func WithModelName(name string) DeriveOption

WithModelName 设置根模型的中文展示名称

Jump to

Keyboard shortcuts

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