當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Project.Entries方法代碼示例

本文整理匯總了Golang中github.com/nexneo/samay/data.Project.Entries方法的典型用法代碼示例。如果您正苦於以下問題:Golang Project.Entries方法的具體用法?Golang Project.Entries怎麽用?Golang Project.Entries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/nexneo/samay/data.Project的用法示例。


在下文中一共展示了Project.Entries方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: showProject

func showProject(project *data.Project) (err error) {
	fmt.Printf("       id : %s\n", project.GetShaFromName())
	fmt.Printf("     name : %s\n", project.GetName())
	fmt.Printf("  entries : %d\n", len(project.Entries()))
	fmt.Printf(" location : %s\n", project.Location())
	return nil
}
開發者ID:DrGo,項目名稱:samay,代碼行數:7,代碼來源:commands.go

示例2: deleteEntry

func deleteEntry(project *data.Project) (err error) {
	for i, entry := range project.Entries() {
		if i == theIdx {
			return data.Destroy(entry)
		}
	}
	return
}
開發者ID:DrGo,項目名稱:samay,代碼行數:8,代碼來源:commands.go

示例3: moveEntry

func moveEntry(project, newProject *data.Project) error {
	for i, entry := range project.Entries() {
		if i == theIdx {
			entry.Project = newProject
			return data.Save(entry)
		}
	}
	return nil
}
開發者ID:DrGo,項目名稱:samay,代碼行數:9,代碼來源:commands.go

示例4: moveProject

func moveProject(project, newProject *data.Project) error {
	for _, entry := range project.Entries() {
		entry.Project = newProject
		if err := data.Save(entry); err != nil {
			return err
		}
	}

	fmt.Printf("All entries copied to project \"%s\" \n...\n", newProject.GetName())
	return deleteProject(project)
}
開發者ID:DrGo,項目名稱:samay,代碼行數:11,代碼來源:commands.go

示例5: showEntry

func showEntry(project *data.Project) (err error) {
	var started, ended *time.Time
	for i, entry := range project.Entries() {
		if i == theIdx {
			started, err = entry.StartedTime()
			ended, err = entry.EndedTime()
			fmt.Printf("       id : %s\n", entry.GetId())
			fmt.Printf(" contents : %s\n", entry.GetContent())
			fmt.Printf(" duration : %s\n", strings.Trim(entry.HoursMins().String(), " "))
			fmt.Printf("  started : %s\n", started)
			fmt.Printf("    ended : %s\n", ended)
			fmt.Printf("     tags : %v\n", entry.GetTags())
			fmt.Printf(" billable : %t\n", entry.GetBillable())
			break
		}
	}
	return err
}
開發者ID:DrGo,項目名稱:samay,代碼行數:18,代碼來源:commands.go


注:本文中的github.com/nexneo/samay/data.Project.Entries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。