• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang doc.Package类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/Unknwon/gowalker/doc.Package的典型用法代码示例。如果您正苦于以下问题:Golang Package类的具体用法?Golang Package怎么用?Golang Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Package类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: updateCacheInfo

func updateCacheInfo(pdoc *doc.Package, urpids, urpts *http.Cookie) (string, string) {
	pdoc.ViewedTime = time.Now().UTC().Unix()

	updateCachePros(pdoc)
	updateProInfos(pdoc)
	return updateUrPros(pdoc, urpids, urpts)
}
开发者ID:JoeyFan,项目名称:gowalker,代码行数:7,代码来源:home.go


示例2: updateRecentPros

func updateRecentPros(pdoc *doc.Package) {
	// Only projects with import path length is less than 40 letters will be showed.
	if len(pdoc.ImportPath) < 40 {
		index := -1
		listLen := len(recentViewedPros)
		curPro := &recentPro{
			Path:       pdoc.ImportPath,
			Synopsis:   pdoc.Synopsis,
			ViewedTime: time.Now().UTC().Unix(),
			IsGoRepo: pdoc.ProjectName == "Go" &&
				strings.Index(pdoc.ImportPath, ".") == -1,
			Views: pdoc.Views,
		}

		pdoc.ViewedTime = curPro.ViewedTime

		// Check if in the list
		for i, s := range recentViewedPros {
			if s.Path == curPro.Path {
				index = i
				break
			}
		}

		s := make([]*recentPro, 0, recentViewedProNum)
		s = append(s, curPro)
		switch {
		case index == -1 && listLen < recentViewedProNum:
			// Not found and list is not full
			s = append(s, recentViewedPros...)
		case index == -1 && listLen >= recentViewedProNum:
			// Not found but list is full
			s = append(s, recentViewedPros[:recentViewedProNum-1]...)
		case index > -1:
			// Found
			s = append(s, recentViewedPros[:index]...)
			s = append(s, recentViewedPros[index+1:]...)
		}
		recentViewedPros = s
	}
}
开发者ID:hendyyou,项目名称:gowalker,代码行数:41,代码来源:home.go


示例3: updateRecentPros

func updateRecentPros(pdoc *doc.Package) {
	index := -1
	listLen := len(recentViewedPros)
	curPro := &recentPro{
		Path:       pdoc.ImportPath,
		ViewedTime: time.Now().UTC().Unix(),
		IsGoRepo:   pdoc.ProjectName == "Go",
		Views:      pdoc.Views,
	}

	pdoc.ViewedTime = curPro.ViewedTime

	// Check if in the list
	for i, s := range recentViewedPros {
		if s.Path == curPro.Path {
			index = i
			break
		}
	}

	s := make([]*recentPro, 0, recentViewedProNum)
	s = append(s, curPro)
	switch {
	case index == -1 && listLen < recentViewedProNum:
		// Not found and list is not full
		s = append(s, recentViewedPros...)
	case index == -1 && listLen >= recentViewedProNum:
		// Not found but list is full
		s = append(s, recentViewedPros[:recentViewedProNum-1]...)
	case index > -1:
		// Found
		s = append(s, recentViewedPros[:index]...)
		s = append(s, recentViewedPros[index+1:]...)
	}
	recentViewedPros = s
}
开发者ID:skelterjohn,项目名称:gowalker,代码行数:36,代码来源:home.go


示例4: 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)
						}
//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gowalker,代码行数:101,代码来源:home.go



注:本文中的github.com/Unknwon/gowalker/doc.Package类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang hv.Package类代码示例发布时间:2022-05-28
下一篇:
Golang goconfig.ConfigFile类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap