ZhangZhihui's Blog  
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 102 下一页

2024年9月7日

摘要: Creating a unit test In Go, it’s standard practice to write your tests in *_test.go files which live directly alongside the code that you’re testing. 阅读全文
posted @ 2024-09-07 16:29 ZhangZhihuiAAA 阅读(17) 评论(0) 推荐(0)
 
摘要: autocommit Command-Line Format --autocommit[={OFF|ON}] System Variable autocommit Scope Global, Session Dynamic Yes SET_VAR Hint Applies No Type Boole 阅读全文
posted @ 2024-09-07 10:31 ZhangZhihuiAAA 阅读(29) 评论(0) 推荐(0)
 
摘要: Using request context At the moment our logic for authenticating a user consists of simply checking whether a "authenticatedUserID" value exists in th 阅读全文
posted @ 2024-09-07 09:22 ZhangZhihuiAAA 阅读(12) 评论(0) 推荐(0)

2024年9月5日

摘要: User authentication Open up your handlers.go file and add placeholders for the five new handler functions as follows: func (app *application) userSign 阅读全文
posted @ 2024-09-05 21:19 ZhangZhihuiAAA 阅读(15) 评论(0) 推荐(0)
 
摘要: The http.Server struct Although http.ListenAndServe() is very useful in short examples and tutorials, in real-world applications it’s more common to m 阅读全文
posted @ 2024-09-05 19:27 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0)
 
摘要: Stateful HTTP A nice touch to improve our user experience would be to display a one-time confirmation message which the user sees after they’ve added 阅读全文
posted @ 2024-09-05 15:17 ZhangZhihuiAAA 阅读(11) 评论(0) 推荐(0)

2024年9月4日

摘要: Processing forms We’re going to add an HTML form for creating new snippets. The form will look a bit like this: The high-level flow for processing thi 阅读全文
posted @ 2024-09-04 22:36 ZhangZhihuiAAA 阅读(17) 评论(0) 推荐(0)
 
摘要: How middleware works In fact, we’re actually already using some middleware in our application — the http.StripPrefix() function from serving static fi 阅读全文
posted @ 2024-09-04 19:05 ZhangZhihuiAAA 阅读(22) 评论(0) 推荐(0)

2024年9月3日

摘要: Displaying dynamic data func (app *application) snippetView(w http.ResponseWriter, r *http.Request) { id, err := strconv.Atoi(r.PathValue("id")) if er 阅读全文
posted @ 2024-09-03 20:00 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0)
 
摘要: Creating a database connection pool // The sql.Open() function initializes a new sql.DB object, which is essentially a // pool of database connections 阅读全文
posted @ 2024-09-03 17:12 ZhangZhihuiAAA 阅读(24) 评论(0) 推荐(0)
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 102 下一页