{"width":"100%","type":"rich","height":"190","image_url":null,"blog_title":"\u3059\u304d\u307e\u98a8","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fradiochemical.hatenablog.com%2Fentry%2F2020%2F11%2F22%2F152511\" title=\"goroutine\u3092\u4f7f\u3063\u3066database\u306b\u4e26\u5217\u3067Insert\u3059\u308b\u30b5\u30f3\u30d7\u30eb - \u3059\u304d\u307e\u98a8\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"database\u306bgoroutine\u3067\u4e26\u884c\u306binsert\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002\u4ed5\u4e8b\u3067\u5fc5\u8981\u306b\u306a\u3063\u3066\u5b9f\u9a13\u3057\u307e\u3057\u305f\u3002 database \u63a5\u7d9a sql.Open() \u3092\u4f7f\u3063\u3066DB Instance\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002DB Instance\u306f\u4e26\u884c\u5b89\u5168\u3067\u3001\u3053\u306eInstance\u304cConnection Pool\u3092\u7ba1\u7406\u3059\u308b\u306e\u3067 Singleton\u306b\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u3067\u5171\u901a\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002 // database.go // \u304b\u3093\u305f\u3093singleton var singletonDB *sql.DB var lock sync.Mutex func Connect() *sql.DB { lock.L\u2026","provider_name":"Hatena Blog","url":"https://radiochemical.hatenablog.com/entry/2020/11/22/152511","published":"2020-11-22 15:25:11","version":"1.0","title":"goroutine\u3092\u4f7f\u3063\u3066database\u306b\u4e26\u5217\u3067Insert\u3059\u308b\u30b5\u30f3\u30d7\u30eb","author_name":"radiochemical","blog_url":"https://radiochemical.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/radiochemical/","provider_url":"https://hatena.blog","categories":["Go","golang","\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u96d1\u8a18"]}