本文整理匯總了Golang中github.com/bbhmakerlab/openinnovation/store.Parser.Time方法的典型用法代碼示例。如果您正苦於以下問題:Golang Parser.Time方法的具體用法?Golang Parser.Time怎麽用?Golang Parser.Time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/bbhmakerlab/openinnovation/store.Parser
的用法示例。
在下文中一共展示了Parser.Time方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UpdateMilestone
func UpdateMilestone(w http.ResponseWriter, r *http.Request) {
var parser store.Parser
projectID := parser.Int(r.FormValue("projectID"))
milestoneID := parser.Int(r.FormValue("milestoneID"))
date := parser.Time(r.FormValue("date"))
if parser.Err != nil {
response.ClientError(w, http.StatusBadRequest)
return
}
user := context.Get(r, "user").(store.User)
if !user.IsAuthor(projectID) {
response.ClientError(w, http.StatusForbidden)
return
}
title := r.FormValue("title")
description := r.FormValue("description")
if err := store.UpdateMilestone(store.UpdateMilestoneParams{
MilestoneID: milestoneID,
Title: title,
Description: description,
Date: date,
}); err != nil {
response.ServerError(w, err)
return
}
response.OK(w, nil)
}
示例2: CreateTask
func CreateTask(w http.ResponseWriter, r *http.Request) {
var parser store.Parser
projectID := parser.Int(r.FormValue("projectID"))
startDate := parser.Time(r.FormValue("startDate"))
endDate := parser.Time(r.FormValue("endDate"))
if parser.Err != nil {
response.ClientError(w, http.StatusBadRequest)
return
}
if startDate.After(endDate) {
response.ClientError(w, http.StatusBadRequest)
return
}
user := context.Get(r, "user").(store.User)
if !user.IsMember(projectID) {
response.ClientError(w, http.StatusForbidden)
return
}
var taskID int64
var err error
if taskID, err = store.CreateTask(store.CreateTaskParams{
AuthorID: user.ID(),
ProjectID: projectID,
Title: r.FormValue("title"),
Description: r.FormValue("description"),
Done: false,
Tags: strings.Split(r.FormValue("tags"), ","),
StartDate: startDate,
EndDate: endDate,
}); err != nil {
response.ServerError(w, err)
return
}
response.OK(w, taskID)
}