assettype

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

internal/assettype/registry.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgBool added in v1.5.0

func ArgBool(args map[string]any, key string) bool

ArgBool 从 args 中解析 bool。支持 bool、字符串 ("true"/"1"/"yes")、数字 1。

func ArgInt

func ArgInt(args map[string]any, key string) int

func ArgInt64

func ArgInt64(args map[string]any, key string) int64

func ArgString

func ArgString(args map[string]any, key string) string

func ArgStringSlice added in v1.5.0

func ArgStringSlice(args map[string]any, key string) []string

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)

Jump to

Keyboard shortcuts

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