1. Reflection 反射工具函数

Helm 提供了基本的反射工具。这有助于高级模板开发者理解特定值的基本Go类型信息。Helm是由Go编写的且是强类型的。 类型系统应用于模板中。

Go 有一些原始 类型,比如 string, slice, int64, 和 bool。

Go 有一个开放的 类型 系统,允许开发者创建自己的类型。

Helm 通过 kind functions 和 type functions 提供了一组函数。 deepEqual 也可以用来比较值。

Kind Functions 有两个类型函数: kindOf 返回对象类型。

kindOf "hello" 上述语句返回 string。对于简单测试(比如在if块中),Kindis函数可以验证值是否为特定类型:

kindIs "int" 123

上述返回 true。

Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2022-01-08 03:09:47

results matching ""

    No results matching ""