Documentation ¶
Overview ¶
package proto
Index ¶
Constants ¶
View Source
const ( VersionFieldName string = "Ver" // struct版本字段名,值为正数,一般定义为:Ver uint8,值从1开始;如果新增定义Ver字段,Ver可定义为无符号数据类型(无符号最小值为0),其它字段的tag ver设置从0开始,这样就可以处理所有字段数据 VersionFieldTagName string = "ver" // struct版本字段tag名,表示定义该字段时的版本号,例如:Data uint32 `ver:"1"`,当 tag ver的值 <= struct版本字段值,本struc字段的数据就会做解码处理;当编码的时候发现 tag ver的值 > struct版本字段值,会panic )
Variables ¶
View Source
var (
ErrNil = errors.New("cstruct: Marshal called with nil")
)
View Source
var OptionSliceIgnoreNil = false
OptionSliceIgnoreNil slice 元素类型为指针时,是否忽略nil
View Source
var OptionSliceStructPointer = true
OptionSliceStructPointer slice 元素类型为结构体时,是否要求为结构体指针
Functions ¶
Types ¶
type Properties ¶
type Properties struct { Name string // contains filtered or unexported fields }
type StructProperties ¶
type StructProperties struct { Prop []*Properties // contains filtered or unexported fields }
func GetProperties ¶
func GetProperties(t reflect.Type) *StructProperties
Click to show internal directories.
Click to hide internal directories.