本文整理匯總了Golang中github.com/oschmid/tessernote.Notebook.PutAll方法的典型用法代碼示例。如果您正苦於以下問題:Golang Notebook.PutAll方法的具體用法?Golang Notebook.PutAll怎麽用?Golang Notebook.PutAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/oschmid/tessernote.Notebook
的用法示例。
在下文中一共展示了Notebook.PutAll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReplaceAllNotes
// ReplaceAllNotes replaces the Notes of the authorized User's Notebook with a new set of Notes. It takes as
// input a JSON formatted list of Notes and writes the added notes if succeeded or an error message otherwise to w.
// Notes may be written back with different IDs than those submitted, see ReplaceNote().
func ReplaceAllNotes(w http.ResponseWriter, r *http.Request, c appengine.Context, notebook *tessernote.Notebook) {
notes, err := readNotes(w, r)
if err != nil {
return
}
err = notebook.DeleteAll(c)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
notes, err = notebook.PutAll(notes, c)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
reply, err := json.Marshal(notes)
if err != nil {
c.Errorf("marshaling notes (%d): %s", len(notes), err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Write(reply)
}