本文整理汇总了Golang中github.com/Unknwon/gowalker/doc.Package.Funcs方法的典型用法代码示例。如果您正苦于以下问题:Golang Package.Funcs方法的具体用法?Golang Package.Funcs怎么用?Golang Package.Funcs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Unknwon/gowalker/doc.Package
的用法示例。
在下文中一共展示了Package.Funcs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ConvertDataFormat
// ConvertDataFormat converts data from database acceptable format to useable format.
func ConvertDataFormat(pdoc *doc.Package, pdecl *models.PkgDecl) error {
// Consts
pdoc.Consts = make([]*doc.Value, 0, 5)
for _, v := range strings.Split(pdecl.Consts, "&$#") {
val := new(doc.Value)
for j, s := range strings.Split(v, "&V#") {
switch j {
case 0: // Name
val.Name = s
case 1: // Doc
val.Doc = s
case 2: // Decl
val.Decl = s
case 3: // URL
val.URL = s
}
}
pdoc.Consts = append(pdoc.Consts, val)
}
pdoc.Consts = pdoc.Consts[:len(pdoc.Consts)-1]
// Variables
pdoc.Vars = make([]*doc.Value, 0, 5)
for _, v := range strings.Split(pdecl.Vars, "&$#") {
val := new(doc.Value)
for j, s := range strings.Split(v, "&V#") {
switch j {
case 0: // Name
val.Name = s
case 1: // Doc
val.Doc = s
case 2: // Decl
val.Decl = s
case 3: // URL
val.URL = s
}
}
pdoc.Vars = append(pdoc.Vars, val)
}
pdoc.Vars = pdoc.Vars[:len(pdoc.Vars)-1]
// Functions
pdoc.Funcs = make([]*doc.Func, 0, 10)
for _, v := range strings.Split(pdecl.Funcs, "&$#") {
val := new(doc.Func)
for j, s := range strings.Split(v, "&F#") {
switch j {
case 0: // Name
val.Name = s
case 1: // Doc
val.Doc = s
case 2: // Decl
val.Decl = s
case 3: // URL
val.URL = s
case 4: // Code
val.Code = *codeDecode(&s)
}
}
pdoc.Funcs = append(pdoc.Funcs, val)
}
pdoc.Funcs = pdoc.Funcs[:len(pdoc.Funcs)-1]
// Types
pdoc.Types = make([]*doc.Type, 0, 10)
for _, v := range strings.Split(pdecl.Types, "&##") {
val := new(doc.Type)
for j, s := range strings.Split(v, "&$#") {
switch j {
case 0: // Type
for y, s2 := range strings.Split(s, "&T#") {
switch y {
case 0: // Name
val.Name = s2
case 1: // Doc
val.Doc = s2
case 2: // Decl
val.Decl = s2
case 3: // URL
val.URL = s2
}
}
case 1: // Functions
val.Funcs = make([]*doc.Func, 0, 2)
for _, v2 := range strings.Split(s, "&M#") {
val2 := new(doc.Func)
for y, s2 := range strings.Split(v2, "&F#") {
switch y {
case 0: // Name
val2.Name = s2
case 1: // Doc
val2.Doc = s2
case 2: // Decl
val2.Decl = s2
case 3: // URL
val2.URL = s2
case 4: // Code
val2.Code = *codeDecode(&s2)
}
//.........这里部分代码省略.........