{"id":366,"date":"2018-11-14T15:00:13","date_gmt":"2018-11-14T06:00:13","guid":{"rendered":"https:\/\/weseek.co.jp\/tech\/?p=366"},"modified":"2023-04-17T10:30:22","modified_gmt":"2023-04-17T01:30:22","slug":"beego-%e3%81%a7%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%9f%e6%8e%b2%e7%a4%ba%e6%9d%bf%e3%82%b5%e3%83%bc%e3%83%93%e3%82%b9%e3%81%ae-go%e8%a8%80%e8%aa%9e%e3%82%92%e8%aa%ad%e3%82%80%e3%80%9c%e3%81%9d%e3%81%ae1","status":"publish","type":"post","link":"https:\/\/weseek.co.jp\/tech\/366\/","title":{"rendered":"beego\u3067\u5b9f\u88c5\u3057\u305f\u63b2\u793a\u677f\u30b5\u30fc\u30d3\u30b9\u306e Go\u8a00\u8a9e\u3092\u8aad\u3080|\u305d\u306e1"},"content":{"rendered":"<p><a href=\"https:\/\/weseek.co.jp\/tech\/518\/\">Go\u8a00\u8a9e\u3067beego \u306e\u30b3\u30fc\u30c9\u81ea\u52d5\u4f5c\u6210\u6a5f\u80fd\u3092\u8a66\u3059<\/a>\u307e\u3067\u30de\u30cb\u30e5\u30a2\u30eb\u3068\u96f0\u56f2\u6c17\u3067\u306a\u3059\u304c\u307e\u307e\u306b\u5b9f\u88c5\u3092\u3057\u3066\u3044\u3066\u3001\u30d5\u30eb\u30b9\u30bf\u30c3\u30af\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u306e\u30b3\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u3068\u3044\u3046\u5f37\u529b\u306a\u30b5\u30dd\u30fc\u30c8\u3082\u3042\u308a\u306a\u304c\u3089\u3001Go \u81ea\u4f53\u3092\u3042\u307e\u308a\u77e5\u3089\u306a\u304f\u3068\u3082\u3067\u304d\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n\u3057\u304b\u3057\u7d30\u304b\u3044\u5b9f\u88c5\u3092\u3059\u308b\u306b\u306f\u81ea\u5206\u306e\u66f8\u3044\u3066\u3044\u308b\u8a00\u8a9e\u3001\u305d\u3057\u3066\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30b3\u30fc\u30c9\u81ea\u4f53\u306b\u3064\u3044\u3066\u6700\u4f4e\u9650\u7406\u89e3\u3057\u3066\u304a\u304f\u3079\u304d\u3068\u3044\u3046\u306e\u306f\u516c\u7136\u306e\u4e8b\u5b9f\u3068\u8a00\u3048\u307e\u3059\u3002<br \/>\n\u3063\u3066\u3053\u3068\u3067\u81ea\u52d5\u751f\u6210\u3057\u305f\u30b3\u30fc\u30c9\u3092\u4e2d\u5fc3\u306b\u8aad\u3093\u3067\u3044\u304d\u3001<a href=\"https:\/\/go-tour-jp.appspot.com\/\">A Tour of Go<\/a> \u306e\u30ea\u30f3\u30af\u306a\u3069\u3092\u4ea4\u3048\u3066\u89e3\u8aac\u3057\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u7b46\u8005\u306f <a href=\"https:\/\/go-tour-jp.appspot.com\/\">A Tour of Go<\/a> \u3092\u4e00\u9031\u3057\u305f\u7a0b\u5ea6\u306a\u306e\u3067\u305d\u3093\u306a\u306b\u9ad8\u5ea6\u306a\u89e3\u8aac\u306f\u671f\u5f85\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002\u3057\u304b\u3057\u521d\u5fc3\u8005\u306a\u308a\u306b\u521d\u5fc3\u8005\u306e\u76ee\u7dda\u3067\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3092\u884c\u3046\u3053\u3068\u3092\u5fc3\u639b\u3051\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u6559\u6750\u306f\u524d\u56de\u307e\u3067\u3084\u3063\u3066\u304d\u305f <a href=\"https:\/\/weseek.co.jp\/tech\/484\/\">go\u8a00\u8a9e+beego\u3067\u63b2\u793a\u677f\u3092\u4f5c\u308b<\/a> \u3067\u4f5c\u6210\u3057\u305f <a href=\"https:\/\/github.com\/haruhikonyan\/beegotest\">\u63b2\u793a\u677f\u98a8\u30a2\u30d7\u30ea<\/a> \u3067\u3059\u3002<\/p>\n<p><!--more--><\/p>\n\n<h2>\/models\/post.go<\/h2>\n<p>\u8a18\u5ff5\u3059\u3079\u304d\u8aad\u3093\u3067\u3044\u304f\u7b2c\u4e00\u53f7\u306f\u3084\u306f\u308a\u30ed\u30fc\u30ec\u30a4\u30e4\u3068\u3044\u3046\u3053\u3068\u3067 models \u306e\u4e2d\u304b\u306a\u3068\u601d\u3044\u3001<a href=\"https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go\">\/models\/post.go<\/a> \u3092\u898b\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>init \u95a2\u6570\u307e\u3067<\/h3>\n<p><a href=\"https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go#L1-L20\">https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go#L1-L20<\/a><br \/>\n\u307e\u305a\u306f\u3053\u306e\u8af8\u3005\u5ba3\u8a00\u3084 go \u3067\u306f\u7279\u5225\u306a\u610f\u5473\u3092\u6301\u3064 <code>init()<\/code> \u307e\u3067\u3092\u78ba\u8a8d\u3057\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p>package<\/p>\n<pre><code>package models<\/code><\/pre>\n<p><a href=\"https:\/\/go-tour-jp.appspot.com\/basics\/1\">Go\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u30d1\u30c3\u30b1\u30fc\u30b8( package )\u3067\u69cb\u6210\u3055\u308c\u307e\u3059\u3002<\/a>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u306f beego \u3068\u3044\u3046\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u304a\u3051\u308b <code>models<\/code> \u306e\u30d5\u30a1\u30a4\u30eb\u7fa4\u3067\u3042\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/li>\n<li>\n<p>import<\/p>\n<pre><code>import (\n\"errors\"\n\"fmt\"\n\"reflect\"\n\"strings\"\n\n\"github.com\/astaxie\/beego\/orm\"\n)<\/code><\/pre>\n<p>\u3053\u306e <code>post.go<\/code> \u3067\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092 <a href=\"https:\/\/go-tour-jp.appspot.com\/basics\/2\">import<\/a> \u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4e00\u65e6\u500b\u3005\u306e import \u3057\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u8aac\u660e\u306f\u7701\u7565\u3057\u307e\u3059\u3002<\/p>\n<\/li>\n<li>\n<p>type Post struct<\/p>\n<p>type Post struct {<br \/>\nId    int64  orm:&quot;auto&quot;<br \/>\nTitle string orm:&quot;size(128)&quot;<br \/>\nBody  string orm:&quot;type(longtext)&quot;<br \/>\n}<\/p>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/go-tour-jp.appspot.com\/moretypes\/2\">struct<\/a> \u3068\u306f\u69cb\u9020\u4f53\u306e\u3053\u3068\u3067\u3001\u500b\u4eba\u7684\u306b\u306f java \u306a\u3069\u306e class \u307f\u305f\u3044\u306a\u3082\u3060\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002C\u8a00\u8a9e\u306b\u3082\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u306d\u3002(\u7b46\u8005\u306fC\u308f\u304b\u3089\u306a\u3044)<br \/>\n<code>Post<\/code> \u3068\u3044\u3046 struct \u3092 new \u3059\u308b\u3068\u3001\u5404 field \u306b . \u3064\u306a\u304e\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u308a\u3001\u305d\u3053\u306b\u5024\u3092\u4ee3\u5165\u3067\u304d\u305f\u308a\u3057\u307e\u3059\u3002<br \/>\nPost \u3068\u3044\u3046\u306e\u306f\u524d\u56de\u307e\u3067\u4f5c\u3063\u3066\u3044\u305f\u63b2\u793a\u677f\u306eDB\u3078\u4fdd\u5b58\u3059\u308b\u66f8\u304d\u8fbc\u307f\u30ec\u30b3\u30fc\u30c91\u3064\u5206\u306b\u5f53\u305f\u308a\u3001field \u3068\u3057\u3066\u4e00\u610f\u306e Id \u3068 Title\u3001Body \u3092\u6301\u3061\u307e\u3059\u3002<br \/>\n\u305d\u308c\u305e\u308c\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u306e\u4e8c\u3064\u76ee\u304c\u578b\u3092\u8868\u3057\u3066\u304a\u308a\u30013\u3064\u76ee\u306f <code>orm<\/code> \u304c\u5185\u90e8\u7684\u306b\u4f7f\u3046 tag \u3067\u3059\u3002<br \/>\n\u30bf\u30b0\u306b\u3064\u3044\u3066\u306f struct \u306e\u6a5f\u80fd\u3067 <a href=\"http:\/\/text.baldanders.info\/golang\/struct-tag\/\">\u3053\u306e\u8fba<\/a> \u53c2\u7167\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u3061\u3087\u3063\u3068 orm \u306e\u516c\u5f0f\u3092\u63a2\u3057\u3066\u3082 tag \u306e\u610f\u5473\u304c\u307e\u3068\u307e\u3063\u3066\u308b\u30da\u30fc\u30b8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c <a href=\"https:\/\/beego.me\/docs\/mvc\/model\/orm.md#models.go%3A\">orm \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306b\u306f\u3061\u3087\u3044\u3061\u3087\u3044\u610f\u5473\u304c\u66f8\u3044\u3066\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p>func init()<\/p>\n<pre><code>func init() {\norm.RegisterModel(new(Post))\n}<\/code><\/pre>\n<p><code>init()<\/code> \u306f\u7279\u5225\u306a\u95a2\u6570\u3067\u3001 <code>main()<\/code> \u3088\u308a\u3082\u5148\u306b\u5b9f\u884c\u3055\u308c\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u521d\u671f\u5316\u306a\u3069\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u306f import \u3057\u305f <code>github.com\/astaxie\/beego\/orm<\/code> \u306e <code>RegisterModel()<\/code> \u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u3066\u3001orm \u3067\u6271\u3046 Post \u30e2\u30c7\u30eb\u306e<a href=\"https:\/\/beego.me\/docs\/mvc\/model\/orm.md#models.go%3A\">\u521d\u671f\u5316<\/a>\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u5404\u7a2e CRUD<\/h3>\n<p><a href=\"https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go#L22-L143\"><\/a><a href=\"https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go#L22-L143\">https:\/\/github.com\/haruhikonyan\/beegotest\/blob\/master\/haruch\/models\/post.go#L22-L143<\/a><br \/>\n\u7d9a\u3044\u3066\u5b9f\u969b\u306bCRUD\u306e\u305f\u3081\u306e\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u3044\u304d\u307e\u3059\u3002\u3053\u308c\u3082\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30b3\u30fc\u30c9\u9054\u3067\u3059\u3002<\/p>\n<ul>\n<li>\n<p>AddPost<\/p>\n<pre><code>\/\/ AddPost insert a new Post into database and returns\n\/\/ last inserted Id on success.\nfunc AddPost(m *Post) (id int64, err error) {\no := orm.NewOrm()\nid, err = o.Insert(m)\nreturn\n}<\/code><\/pre>\n<p><a href=\"https:\/\/beego.me\/docs\/mvc\/model\/object.md#insert\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306e\u305d\u306e\u307e\u307e\u3067 <code>orm<\/code> \u306e\u6a5f\u80fd\u3092\u4f7f\u3044\u3001DB\u306b\u66f8\u304d\u8fbc\u3080\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<br \/>\n\u4efb\u610f\u306e <code>Post<\/code> \u3092\u5f15\u6570 <code>m<\/code> \u3068\u3057\u3066\u53d6\u308a\u3001<code>orm.NewOrm()<\/code> \u3067 <code>orm<\/code> \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092 <code>o<\/code> \u3068\u3044\u3046\u5909\u6570\u306b\u53d6\u308a\u3001<code>Insert()<\/code> \u3078\u5f15\u6570\u3068\u3057\u3066\u53d7\u3051\u53d6\u3063\u305f <code>Post<\/code> \u3092\u6e21\u3057\u3066\u3057\u3066DB\u306b\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n<code>Insert()<\/code> \u306e\u8fd4\u308a\u5024\u3068\u3057\u3066\u306f\u4fdd\u5b58\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u306e <code>id<\/code> \u3068\u30a8\u30e9\u30fc\u304c\u3042\u308c\u3070 <code>err<\/code> \u8fd4\u3057\u3001\u305d\u308c\u3092\u305d\u306e\u307e\u307e <code>AddPost<\/code> \u306e\u8fd4\u308a\u5024\u3068\u3057\u3066 return \u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nreturn \u3068\u3057\u304b\u66f8\u3044\u3066\u3044\u306a\u304f\u3068\u3082\u95a2\u6570\u306e\u5ba3\u8a00\u3067 <code>(id int64, err error)<\/code> \u3068\u5f15\u6570\u306b\u540d\u524d\u304c\u3064\u3044\u3066\u3044\u308b\u305f\u3081\u3001\u305d\u306e\u540d\u524d\u306e\u5909\u6570\u304c\u81ea\u52d5\u7684\u306b return \u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3092 Go \u306b\u304a\u3051\u308b<a href=\"https:\/\/go-tour-jp.appspot.com\/basics\/7\">naked return<\/a>\u3068\u3044\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001Go \u306e\u7279\u5fb4\u306e\u4e00\u3064\u306b\u8fd4\u308a\u5024\u306b\u8907\u6570\u3092\u8fd4\u305b\u308b\u3068\u3044\u3046\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<\/li>\n<li>\n<p>GetPostById<\/p>\n<pre><code>\/\/ GetPostById retrieves Post by Id. Returns error if\n\/\/ Id doesn't exist\nfunc GetPostById(id int64) (v *Post, err error) {\no := orm.NewOrm()\nv = &Post{Id: id}\nif err = o.QueryTable(new(Post)).Filter(\"Id\", id).RelatedSel().One(v); err == nil {\n    return v, nil\n}\nreturn nil, err\n}<\/code><\/pre>\n<p>\u3053\u3061\u3089\u306f <code>id<\/code> \u3092\u53d7\u3051\u53d6\u3063\u3066 Post \u30e2\u30c7\u30eb\u306e\u5b9f\u4f53\u3092 DB \u304b\u3089\u53d6\u5f97\u3057\u3066\u8fd4\u3059\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<br \/>\n<code>o<\/code> \u306f\u5148\u307b\u3069\u3068\u540c\u3058\u304f <code>orm<\/code> \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u3066\u304a\u308a\u3001 <code>v = &amp;Post{Id: id}<\/code> \u306b\u3066\u4e0a\u90e8\u3067\u5b9a\u7fa9\u3057\u305f <code>Post<\/code> struct \u3092\u65b0\u305f\u306b\u5b9a\u7fa9\u3057\u3001\u305d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306e Id \u306b \u5f15\u6570\u3067\u53d7\u3051\u53d6\u3063\u305f <code>id<\/code> \u3092\u30bb\u30c3\u30c8\u3057\u3066\u3057\u3066\u3001\u5909\u6570 <code>v<\/code> \u3078 &amp;\u304c\u3064\u3044\u3066\u3044\u308b\u306e\u3067\u30a2\u30c9\u30ec\u30b9\u3092\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nstruct \u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3084\u5b9a\u7fa9\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/go-tour-jp.appspot.com\/moretypes\/4\">\u3053\u306e\u8fba\u308a<\/a>\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<br \/>\n\u307e\u305f\u3001\u30dd\u30a4\u30f3\u30bf\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/go-tour-jp.appspot.com\/moretypes\/1\">\u3053\u306e\u8fba\u308a<\/a>\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<br \/>\n<code>o.QueryTable(new(Post)).Filter(&quot;Id&quot;, id).RelatedSel().One(v)<\/code> \u3053\u306e\u51e6\u7406\u3067\u3059\u304c\u9806\u306b\u3001<\/p>\n<\/li>\n<li>\n<p>o.QueryTable(new(Post))<br \/>\n\u307e\u305a <code>orm<\/code> \u306e<a href=\"https:\/\/beego.me\/docs\/mvc\/model\/query.md#advanced-queries\">QueryTable()<\/a>\u30e1\u30bd\u30c3\u30c9\u3067\u4e00\u756a\u4e0a\u306e\u4f8b\u306e2\u3064\u76ee\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u81ea\u4f53\u3092\u30c6\u30fc\u30d6\u30eb\u540d\u3068\u3057\u3066\u4f7f\u3044\u3001 <code>QuerySeter<\/code> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002(QuerySeter\u3063\u3066\u306a\u3093\u3060\uff1f)<br \/>\nQuerySeter \u306f\u4efb\u610f\u306e table \u306b\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3068\u3044\u3046\u8a8d\u8b58\u3067\u3059\u3002<\/p>\n<\/li>\n<li>\n<p>.Filter(&quot;Id&quot;, id).RelatedSel().One(v)<br \/>\n<a href=\"https:\/\/beego.me\/docs\/mvc\/model\/query.md#expr\">Filter()<\/a> \u3067<code>Id<\/code> \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067 SQL \u3067\u3044\u3046 <code>WHERE Id = 1<\/code> \u3067\u7d5e\u308a\u8fbc\u307f\u3092\u884c\u3044\u3001<a href=\"https:\/\/beego.me\/docs\/mvc\/model\/query.md#relatedsel\">RelatedSel()<\/a> \u3067\u3001\u4f55\u3082\u5f15\u6570\u3092\u6307\u5b9a\u3057\u306a\u3044\u3053\u3068\u3067\u3001\u95a2\u9023\u30c6\u30fc\u30d6\u30eb\u3092\u3059\u3079\u3066 Join \u3057\u307e\u3059\u3002\u6700\u5f8c\u306b <a href=\"https:\/\/beego.me\/docs\/mvc\/model\/query.md#one\">One(v)<\/a> \u3067\u3001 <code>v<\/code> \u3064\u307e\u308a Post \u30ec\u30b3\u30fc\u30c9\u3092\u4e00\u3064\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<\/li>\n<li>\n<p>if err = \u5f0f; err == nil {}<br \/>\n<a href=\"https:\/\/go-tour-jp.appspot.com\/flowcontrol\/6\">if\u6587\u306e\u66f8\u304d\u65b9<\/a>\u3067\u3059\u306d\u3002<code>err<\/code>\u3092\u53d6\u5f97\u3057\u3001\u3082\u3057 <code>err<\/code> \u304c nil \u3067\u3042\u308c\u3070\u3001\u30a8\u30e9\u30fc\u304c\u7121\u3044\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\u53d6\u5f97\u3057\u305f Post <code>v<\/code> \u3068 <code>err<\/code> \u3092 nil \u3067\u8fd4\u3057\u3001\u3082\u3057 <code>err<\/code> \u304c\u5b58\u5728\u3057\u305f\u3089\u30a8\u30e9\u30fc\u3092 retrun \u3059\u308b\u3068\u3044\u3046\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u4e00\u65e6\u3053\u3053\u307e\u3067\u306b\u3057\u307e\u3059\u3002<br \/>\n\u6700\u521d\u306b\u3082\u8a00\u3063\u305f\u901a\u308a\u7b46\u8005\u306f <a href=\"https:\/\/go-tour-jp.appspot.com\/\">A Tour of Go<\/a> \u3092\u8efd\u304f\u4e00\u9031\u3057\u305f\u7a0b\u5ea6\u3060\u3051\u306a\u306e\u3067\u3059\u304c\u3001\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u3064\u3064\u3001Go\u306e\u9759\u7684\u578b\u4ed8\u3051\u8a00\u8a9e\u3068\u3044\u3046\u7279\u6027\u3067\u30a8\u30c7\u30a3\u30bf\u306e\u4fdd\u7ba1\u3092\u3046\u307e\u304f\u6d3b\u7528\u3057\u3066\u3044\u3051\u3070\u305d\u3053\u307e\u3067\u8eab\u69cb\u3048\u308b\u5fc5\u8981\u3082\u7121\u3044\u3068\u3044\u3046\u5370\u8c61\u3067\u3057\u305f\u3002<br \/>\n\u6b21\u56de\u3082\u5f15\u304d\u7d9a\u304d <code>\/models\/post.go<\/code> \u3092\u8aad\u3093\u3067\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002 <code>GetAllPost()<\/code> \u3067\u306f <a href=\"https:\/\/go-tour-jp.appspot.com\/methods\/9\">interface<\/a> \u3082\u51fa\u3066\u304f\u308b\u306e\u3067\u4eca\u4e00\u5ea6\u8aad\u307f\u76f4\u305d\u3046\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go\u8a00\u8a9e\u3067beego \u306e\u30b3\u30fc\u30c9\u81ea\u52d5\u4f5c\u6210\u6a5f\u80fd\u3092\u8a66\u3059\u307e\u3067\u30de\u30cb\u30e5\u30a2\u30eb\u3068\u96f0\u56f2\u6c17\u3067\u306a\u3059\u304c\u307e\u307e\u306b\u5b9f\u88c5\u3092\u3057\u3066\u3044\u3066\u3001\u30d5\u30eb\u30b9\u30bf\u30c3\u30af\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u306e\u30b3\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u3068\u3044\u3046\u5f37\u529b\u306a\u30b5\u30dd\u30fc\u30c8\u3082\u3042\u308a\u306a\u304c\u3089\u3001Go \u81ea\u4f53\u3092\u3042\u307e\u308a\u77e5\u3089\u306a\u304f\u3068\u3082\u3067\u304d\u3066\u3044\u307e\u3057<\/p>\n","protected":false},"author":3,"featured_media":395,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/posts\/366"}],"collection":[{"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":27,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":4095,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/posts\/366\/revisions\/4095"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/media\/395"}],"wp:attachment":[{"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weseek.co.jp\/tech\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}