本文整理匯總了Golang中github.com/Unknwon/gowalker/doc.Package.Vars方法的典型用法代碼示例。如果您正苦於以下問題:Golang Package.Vars方法的具體用法?Golang Package.Vars怎麽用?Golang Package.Vars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Unknwon/gowalker/doc.Package
的用法示例。
在下文中一共展示了Package.Vars方法的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)
}
//.........這裏部分代碼省略.........