1 Star 0 Fork 0

笑看风云 / gocodes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ref-iface.go 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
笑看风云 提交于 2022-01-03 21:11 . 大改之前
package reflectx
type IRefObject interface {
// RefType 结构的类名
RefType() string
}
type IRefType interface {
// RefType 结构的类名
RefType() string
// RefNew 生成结构
RefNew() IRefObject
}
type IRefField interface {
IRefType
// RefHas 是否包含字段
RefHas(field string) bool
// RefGet 获取field的值
RefGet(obj IRefObject, field string) (val interface{}, isNil bool)
// RefSet 设置field的值
RefSet(obj IRefObject, field string, val interface{})
}
type IRefMap interface {
IRefField
RefMapGet(obj IRefObject, field string, key string) (val interface{}, isNil bool)
RefMapSet(obj IRefObject, field string, key string, val interface{})
RefMapKeys(obj IRefObject, field string) []string
RefMapNew(field string) interface{}
}
type IRefSlice interface {
IRefField
RefSliceGet(obj IRefObject, field string, index int) (val interface{}, isNil bool)
RefSliceSet(obj IRefObject, field string, index int, val interface{})
RefSliceNew(field string, len int, cap int) interface{}
RefSliceLength(obj IRefObject, field string) int
}
func init() {
list := []IRefType{
&ClassDeclRef{},
&InterfaceDeclRef{},
&FieldRef{},
&EnumDeclRef{},
&AnyTypeRef{},
&BasicTypeRef{},
&ClassTypeRef{},
&EnumTypeRef{},
&MapTypeRef{},
&ArrayTypeRef{},
&FuncTypeRef{},
}
for _, val := range list {
AddType(val)
}
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhongguo168a/gocodes.git
git@gitee.com:zhongguo168a/gocodes.git
zhongguo168a
gocodes
gocodes
46752958e769

搜索帮助

344bd9b3 5694891 D2dac590 5694891