Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
sys.PtrSize
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FuncHeader ¶
type FuncHeader struct {
Doc string // docs above func
Name string
In []*Parameter
Out []*Parameter
}
FuncHeader contains function info
func GetFuncHeader ¶
func GetFuncHeader(originFunc interface{}) (fh FuncHeader, err error)
GetFuncHeader return function header in runtime
Example ¶
// // Person ...
// type Person struct{}
//
// // comment
// func (this Person) Name() string {
// return `noname`
// }
//
// // Say can say something
// func (this Person) Say(c string) string {
// return this.Name() + ` : ` + c
// }
h, _ := GetFuncHeader(Person{}.Say)
log.Println(h.Name)
//: Say-fm
log.Println(h.Doc)
//: // Say can say something
for _, param := range append(h.In, h.Out...) {
log.Println(param.Name, param.RType)
//: c string
//: string
}
func GetFuncHeaderNoCache ¶
func GetFuncHeaderNoCache(originFunc interface{}) (fh FuncHeader, err error)
GetFuncHeaderNoCache is optional way when the cache is incorrect
func (*FuncHeader) Encode ¶
func (fh *FuncHeader) Encode() string
Encode is convenient for json marshal
func (*FuncHeader) Equals ¶
func (fh *FuncHeader) Equals(other *FuncHeader) bool
Equals return two header is equivalent for testing
Click to show internal directories.
Click to hide internal directories.