Documentation
¶
Overview ¶
internal/assettype/registry.go
Index ¶
- func ArgBool(args map[string]any, key string) bool
- func ArgInt(args map[string]any, key string) int
- func ArgInt64(args map[string]any, key string) int64
- func ArgString(args map[string]any, key string) string
- func ArgStringSlice(args map[string]any, key string) []string
- func Register(h AssetTypeHandler)
- type AssetTypeHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgStringSlice ¶ added in v1.5.0
ArgStringSlice 从 args 中解析字符串数组。支持 []string、[]any、用逗号/分号/换行分隔的字符串。 自动 trim 空白并丢弃空项。
func Register ¶
func Register(h AssetTypeHandler)
Types ¶
type AssetTypeHandler ¶
type AssetTypeHandler interface {
Type() string
DefaultPort() int
SafeView(a *asset_entity.Asset) map[string]any
ResolvePassword(ctx context.Context, a *asset_entity.Asset) (string, error)
DefaultPolicy() any
// PolicyKind 返回该资产类型所用的规范 policyKind(见 entity/policy.PolicyKind*)。
// 经 Register 写入 entity/policy 的 asset-kind 注册表,供 ai/policy.ResolvePolicyKind 派生。
PolicyKind() string
// ValidateCreateArgs 校验 AI 工具创建资产时的必填字段。
// 由 handleAddAsset 在 ApplyCreateArgs 之前调用,每种类型自行声明所需字段。
ValidateCreateArgs(args map[string]any) error
ApplyCreateArgs(ctx context.Context, a *asset_entity.Asset, args map[string]any) error
ApplyUpdateArgs(ctx context.Context, a *asset_entity.Asset, args map[string]any) error
}
AssetTypeHandler 资产类型处理器接口。
func All ¶
func All() []AssetTypeHandler
func Get ¶
func Get(assetType string) (AssetTypeHandler, bool)
Click to show internal directories.
Click to hide internal directories.