Documentation
¶
Index ¶
- func AddDecl(decl IDecl) (err error)
- func AddDecls(decls []IDecl) (err error)
- func CheckObject(obj datax.M, decl *ClassDecl) (err error)
- func CheckType(valType IType, val interface{}) (err error)
- func GetDeclByStructKey(st interface{}) string
- func InitObj(obj datax.M, decl *ClassDecl) (err error)
- func JustifyAnyType(ival interface{}, ftyp *AnyType) (interface{}, error)
- func JustifyEnumType(ival interface{}, ftyp *EnumType) (interface{}, error)
- func JustifyObject(obj datax.M, decl *ClassDecl) (result datax.M, err error)
- func ParseJson(content string) (err error)
- type AnyType
- type ArrayType
- type BasicType
- type ClassDecl
- func (decl *ClassDecl) GetAllField() (r []*Field)
- func (decl *ClassDecl) GetField(name string) (f *Field)
- func (decl *ClassDecl) GetIdent() string
- func (decl *ClassDecl) GetName() string
- func (decl *ClassDecl) GetNamespace() string
- func (decl *ClassDecl) GetParent() *ClassDecl
- func (decl *ClassDecl) RefType() string
- type ClassType
- type EnumDecl
- func (decl *EnumDecl) ConvertToValue(ival interface{}) (r interface{})
- func (decl *EnumDecl) GetIdent() string
- func (decl *EnumDecl) GetName() string
- func (decl *EnumDecl) GetNamespace() string
- func (decl *EnumDecl) NameIndex(name string) int
- func (decl *EnumDecl) NameToValue(name string) (r interface{})
- func (decl *EnumDecl) NameToValueString(name string) (r string)
- func (decl *EnumDecl) RefType() string
- func (decl *EnumDecl) ValueIndex(val string) int
- func (decl *EnumDecl) ValueToName(ival interface{}) (r string)
- type EnumType
- type Field
- type FuncType
- type IDecl
- type IObject
- type IType
- type InterfaceDecl
- type MapType
- type UnsafeInfo
- type Visitor
- type VisitorContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDeclByStructKey ¶
func GetDeclByStructKey(st interface{}) string
func JustifyAnyType ¶
func JustifyEnumType ¶
func JustifyObject ¶
JustifyObject 如果是数字,会转化成正确的类型
Types ¶
type ClassDecl ¶
type ClassDecl struct { // Namespace string // Name string // Parent string // 如果Kind==Struct Fields []*Field // Comments []string // Tags map[string]string }
func ParseClass ¶
func (*ClassDecl) GetAllField ¶
GetAllField 获取类的属性字段,包括父类
func (*ClassDecl) GetNamespace ¶
type EnumDecl ¶
type EnumDecl struct { // Namespace string Comments []string // Name string // Kind int // Fields []*Field }
func ParseEnum ¶
func ParseEnum(val interface{}) *EnumDecl
golang不支持枚举类型,无法在运行时解析 如需枚举需求,可通过注解工具创建枚举代码
func (*EnumDecl) ConvertToValue ¶
func (decl *EnumDecl) ConvertToValue(ival interface{}) (r interface{})
func (*EnumDecl) GetNamespace ¶
func (*EnumDecl) NameToValue ¶
func (*EnumDecl) NameToValueString ¶
func (*EnumDecl) ValueIndex ¶
func (*EnumDecl) ValueToName ¶
type Field ¶
type IDecl ¶
func CreateDecl ¶
func GetDeclByKey ¶
func GetDeclByStruct ¶
func GetDeclByStruct(st interface{}) IDecl
type InterfaceDecl ¶
type InterfaceDecl struct { // Namespace string Comments []string // Name string // Kind int // Fields []*Field }
func (*InterfaceDecl) GetIdent ¶
func (decl *InterfaceDecl) GetIdent() string
func (*InterfaceDecl) GetName ¶
func (decl *InterfaceDecl) GetName() string
func (*InterfaceDecl) GetNamespace ¶
func (decl *InterfaceDecl) GetNamespace() string
func (*InterfaceDecl) RefType ¶
func (decl *InterfaceDecl) RefType() string
type UnsafeInfo ¶
type Visitor ¶
type Visitor struct {
// contains filtered or unexported fields
}
func (*Visitor) SetHandler ¶
func (visitor *Visitor) SetHandler(f func(visitor *VisitorContext))
type VisitorContext ¶
type VisitorContext struct { // pos=all CurrentType IType // pos=class/field CurrentField *Field // field name / array index / map key CurrentKey string CurrentSourceParent datax.M CurrentSource interface{} CurrentTargetParent datax.M CurrentTarget interface{} CurrentDecl IDecl // contains filtered or unexported fields }
func (*VisitorContext) SetFieldValue ¶
func (visitor *VisitorContext) SetFieldValue(val interface{})
设置当前字段的值
Source Files
¶
Click to show internal directories.
Click to hide internal directories.