{"id":303193,"date":"2020-05-07T21:00:13","date_gmt":"2020-05-07T21:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303193"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303193","title":{"rendered":"\u041a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0432 Go \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0411\u0414"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501000\/\">\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 Golang. \u0417\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u043f\u043e Go \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0440\u043d\u044b\u0435 \u0441\u043f\u043e\u0440\u044b. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0430\u043b\u043e, \u0445\u043e\u0442\u044f \u043e\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 Go. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0444\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u043e\u0431\u043e\u0439\u0434\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 \u0438 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0442\u0435\u043c\u0435 <a href=\"https:\/\/habr.com\/ru\/post\/269887\/\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/306672\/\">\u0442\u0443\u0442<\/a>, \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ul>\n<li>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u0434\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438;<\/li>\n<li>\u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0443\u0442\u0438\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 (\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0435\u0439);<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0431\u0435\u0440\u0442\u043e\u043a \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c.<\/li>\n<\/ul>\n<p>  \u0418\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Stringer, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u044f\u0437\u044b\u043a\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b String() \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u0421 \u0435\u0435 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0438\u043c\u0435\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u044f\u0445. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u044b\u043b \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0438\u0437 \u043f\u0430\u043b\u0438\u0442\u0440\u044b. \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u0430\u043b\u0438\u0442\u0440\u044b.<\/p>\n<p>  \u0418\u0437 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 easyjson \u043e\u0442 Mail.ru. \u0414\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 masrshall\/unmarshall JSON \u0438\u0437\/\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0418\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c \u043e\u0431\u043e\u0448\u043b\u0430 \u0432\u0441\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c easyjson, \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u043b\u0438\u0431\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \/\/easyjson:json. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"go\">type User struct{     ID int     Login string     Email string     Level int }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"bash\">easyjson -all main.go<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043b\u044f User \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<ul>\n<li>MarshalEasyJSON (w*jwriter.Writer) \u2014 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442 JSON;<\/li>\n<li>UnmarshalEasyJSON (l *jlexer.Lexer) \u2014 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. <\/li>\n<\/ul>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u0438 MarshalJSON() ([]byte, error) \u0438 UnmarshalJSON (data []byte) error \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c json.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 easyjson<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func TestEasyJSON() { \ttestJSON := `{&quot;ID&quot;:123, &quot;Login&quot;:&quot;TestUser&quot;, &quot;Email&quot;:&quot;user@gmail.com&quot;, &quot;Level&quot;:12}` \tJSONb := []byte(testJSON) \tfmt.Println(testJSON) \trecvUser := &User{} \trecvUser.UnmarshalJSON(JSONb) \tfmt.Println(recvUser) \trecvUser.Level += 1 \toutJSON, _ := recvUser.MarshalJSON() \tfmt.Println(string(outJSON)) } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c JSON \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f JSON. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 easyjson \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0440\u0435\u0444\u043b\u0435\u043a\u0446\u0438\u0438 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u043e gRPC. \u0412 \u043d\u0435\u043c \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442 protobuf \u2014 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 EDL. \u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 protoc, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u0441\u0433\u0435\u043d\u0435\u043d\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u0435\u0434\u0438\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u043e\u043d \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u043b\u0435\u0439 \u0444\u043e\u0440\u043c, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 Middleware, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043a \u0421\u0423\u0411\u0414.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 Go<\/h2>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043a\u0430\u043a \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 Go. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u043e AST \u2014 Abstract Syntax Tree \u0438\u043b\u0438 \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e. \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435_\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435_\u0434\u0435\u0440\u0435\u0432\u043e\">\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044e<\/a>. \u0414\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0433\u0440\u0430\u0444\u0430, \u0433\u0434\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b (\u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b) \u0441\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438\u00a0\u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u043b\u0438\u0441\u0442\u044c\u044f \u2014 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438\u00a0\u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430\u043c\u0438. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p>  <a href=\"https:\/\/golang.org\/pkg\/go\/ast\/\">go\/ast<\/a><br \/>  <a href=\"https:\/\/golang.org\/pkg\/go\/parser\/\">go\/parser\/<\/a><br \/>  <a href=\"https:\/\/golang.org\/pkg\/go\/token\/\">go\/token\/<\/a><\/p>\n<p>  \u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043a\u043e\u0434\u043e\u043c \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438<\/p>\n<pre><code class=\"go\"> fset := token.NewFileSet() node, err := parser.ParseFile(fset, os.Args[1], nil, parser.ParseComments) <\/code><\/pre>\n<p>  \u041c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0441\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0434\u0435\u0440\u0435\u0432\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. <\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c (\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u0434\u0430, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0434) \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043b\u0438\u0431\u043e \u0442\u0435\u0433\u0438 (\u043a\u0430\u043a \u043c\u044b \u043f\u0438\u0448\u0435\u043c `json:&quot;&quot;` \u0432\u043e\u0437\u043b\u0435 \u043f\u043e\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b).<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0435\u043c\u0443 \u0444\u0430\u0439\u043b, \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 (CRUD \u043c\u0435\u0442\u043e\u0434\u044b) \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0411\u0414. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 dbe:{\u00abtable\u00bb:\u00abusers\u00bb}, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440;<\/li>\n<li>\u0442\u0435\u0433 dbe \u0443 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0434\u043b\u044f \u0411\u0414: primary_key \u0438 not_null. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u0440\u0438\u0447\u0435\u043c \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &quot;-&quot;, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446.<\/li>\n<\/ul>\n<p>  \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u043e\u0435\u0432\u043e\u0439, \u0432 \u043d\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0447\u0430\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0438 \u0437\u0430\u0449\u0438\u0442. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430. <\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0431\u0443\u0434\u0443\u0442 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u043e\u0431\u0445\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u0412 Go \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b: BadDecl, GenDecl \u0438 FuncDecl.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/\/ A BadDecl node is a placeholder for declarations containing \/\/ syntax errors for which no correct declaration nodes can be \/\/ created. \/\/ BadDecl struct {     From, To token.Pos \/\/ position range of bad declaration } \/\/ A GenDecl node (generic declaration node) represents an import, \/\/ constant, type or variable declaration. A valid Lparen position \/\/ (Lparen.IsValid()) indicates a parenthesized declaration. \/\/ \/\/ Relationship between Tok value and Specs element type: \/\/ \/\/ token.IMPORT *ImportSpec \/\/ token.CONST *ValueSpec \/\/ token.TYPE *TypeSpec \/\/ token.VAR *ValueSpec \/\/ GenDecl struct {     Doc *CommentGroup \/\/ associated documentation; or nil     TokPos token.Pos \/\/ position of Tok     Tok token.Token \/\/ IMPORT, CONST, TYPE, VAR     Lparen token.Pos \/\/ position of '(', if any     Specs []Spec     Rparen token.Pos \/\/ position of ')', if any } \/\/ A FuncDecl node represents a function declaration. FuncDecl struct {     Doc *CommentGroup \/\/ associated documentation; or nil     Recv *FieldList \/\/ receiver (methods); or nil (functions)     Name *Ident \/\/ function\/method name     Type *FuncType \/\/ function signature: parameters, results, and position of &quot;func&quot; keyword     Body *BlockStmt \/\/ function body; or nil for external (non-Go) function } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c GenDecl. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d FuncDecl, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0430\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043c \u043e\u043d\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b. \u0414\u0430\u043b\u0435\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 Specs, \u0438 \u0438\u0449\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043f\u043e\u043b\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 (*ast.TypeSpec) \u0438 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 (*ast.StructType). \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u044d\u0442\u043e \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \/\/dbe. \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043d\u0438\u0436\u0435.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0431\u0445\u043e\u0434 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> for _, f := range node.Decls { \tgenD, ok := f.(*ast.GenDecl) \tif !ok { \t\tfmt.Printf(&quot;SKIP %T is not *ast.GenDecl\\n&quot;, f) \t\tcontinue \t} \ttargetStruct := &StructInfo{} \tvar thisIsStruct bool \tfor _, spec := range genD.Specs { \t\tcurrType, ok := spec.(*ast.TypeSpec) \t\tif !ok { \t\t\tfmt.Printf(&quot;SKIP %T is not ast.TypeSpec\\n&quot;, spec) \t\t\tcontinue \t\t}  \t\tcurrStruct, ok := currType.Type.(*ast.StructType) \t\tif !ok { \t\t\tfmt.Printf(&quot;SKIP %T is not ast.StructType\\n&quot;, currStruct) \t\t\tcontinue \t\t} \t\ttargetStruct.Name = currType.Name.Name \t\tthisIsStruct = true \t} \t\/\/Getting comments \tvar needCodegen bool \tvar dbeParams string \tif thisIsStruct { \t\tfor _, comment := range genD.Doc.List { \t\t\tneedCodegen = needCodegen || strings.HasPrefix(comment.Text, &quot;\/\/ dbe&quot;) \t\t\tif len(comment.Text) &lt; 7 { \t\t\t\tdbeParams = &quot;&quot; \t\t\t} else { \t\t\t\tdbeParams = strings.Replace(comment.Text, &quot;\/\/ dbe:&quot;, &quot;&quot;, 1) \t\t\t} \t\t} \t} \tif needCodegen { \t\ttargetStruct.Target = genD \t\tgenParams := &DbeParam{} \t\tif len(dbeParams) != 0 { \t\t\terr := json.Unmarshal([]byte(dbeParams), genParams) \t\t\tif err != nil { \t\t\t\tfmt.Printf(&quot;Error encoding DBE params for structure %s\\n&quot;, targetStruct.Name) \t\t\t\tcontinue \t\t\t} \t\t} else { \t\t\tgenParams.TableName = targetStruct.Name \t\t}  \t\ttargetStruct.GenParam = genParams \t\tgenerateMethods(targetStruct, out) \t} }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"go\">type DbeParam struct { \tTableName string `json:&quot;table&quot;` }  type StructInfo struct { \tName     string \tGenParam *DbeParam \tTarget   *ast.GenDecl }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044f\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b (createTable) \u0438 CRUD \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func generateMethods(reqStruct *StructInfo, out *os.File) { \tfor _, spec := range reqStruct.Target.Specs { \t\tfmt.Fprintln(out, &quot;&quot;) \t\tcurrType, ok := spec.(*ast.TypeSpec) \t\tif !ok { \t\t\tcontinue \t\t} \t\tcurrStruct, ok := currType.Type.(*ast.StructType) \t\tif !ok { \t\t\tcontinue \t\t}  \t\tfmt.Printf(&quot;\\tgenerating createTable methods for %s\\n&quot;, currType.Name.Name)  \t\tcurTable := &TableInfo{ \t\t\tTableName: reqStruct.GenParam.TableName, \t\t\tColumns:   make([]*ColInfo, 0, len(currStruct.Fields.List)), \t\t}  \t\tfor _, field := range currStruct.Fields.List { \t\t\tif len(field.Names) == 0 { \t\t\t\tcontinue \t\t\t} \t\t\ttableCol := &ColInfo{FieldName: field.Names[0].Name} \t\t\tvar fieldIsPrimKey bool \t\t\tvar preventThisField bool \t\t\tif field.Tag != nil { \t\t\t\ttag := reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]) \t\t\t\ttagVal := tag.Get(&quot;dbe&quot;) \t\t\t\tfmt.Println(&quot;dbe:&quot;, tagVal) \t\t\t\ttagParams := strings.Split(tagVal, &quot;,&quot;) \t\t\tPARAMSLOOP: \t\t\t\tfor _, param := range tagParams { \t\t\t\t\tswitch param { \t\t\t\t\tcase &quot;primary_key&quot;: \t\t\t\t\t\tif curTable.PrimaryKey == nil { \t\t\t\t\t\t\tfieldIsPrimKey = true \t\t\t\t\t\t\ttableCol.NotNull = true \t\t\t\t\t\t} else { \t\t\t\t\t\t\tlog.Panicf(&quot;Table %s cannot have more then 1 primary key!&quot;, currType.Name.Name) \t\t\t\t\t\t} \t\t\t\t\tcase &quot;not_null&quot;: \t\t\t\t\t\ttableCol.NotNull = true \t\t\t\t\tcase &quot;-&quot;: \t\t\t\t\t\tpreventThisField = true \t\t\t\t\t\tbreak PARAMSLOOP \t\t\t\t\tdefault: \t\t\t\t\t\ttableCol.ColName = param \t\t\t\t\t}  \t\t\t\t} \t\t\t\tif preventThisField { \t\t\t\t\tcontinue \t\t\t\t} \t\t\t} \t\t\tif tableCol.ColName == &quot;&quot; { \t\t\t\ttableCol.ColName = tableCol.FieldName \t\t\t} \t\t\tif fieldIsPrimKey { \t\t\t\tcurTable.PrimaryKey = tableCol \t\t\t} \t\t\t\/\/Determine field type \t\t\tvar fieldType string \t\t\tswitch field.Type.(type) { \t\t\tcase *ast.Ident: \t\t\t\tfieldType = field.Type.(*ast.Ident).Name \t\t\tcase *ast.SelectorExpr: \t\t\t\tfieldType = field.Type.(*ast.SelectorExpr).Sel.Name \t\t\t} \t\t\t\/\/fieldType := field.Type.(*ast.Ident).Name \t\t\tfmt.Printf(&quot;%s- %s\\n&quot;, tableCol.FieldName, fieldType) \t\t\t\/\/Check for integers \t\t\tif strings.Contains(fieldType, &quot;int&quot;) { \t\t\t\ttableCol.ColType = &quot;integer&quot; \t\t\t} else { \t\t\t\t\/\/Check for other types \t\t\t\tswitch fieldType { \t\t\t\tcase &quot;string&quot;: \t\t\t\t\ttableCol.ColType = &quot;text&quot; \t\t\t\tcase &quot;bool&quot;: \t\t\t\t\ttableCol.ColType = &quot;boolean&quot; \t\t\t\tcase &quot;Time&quot;: \t\t\t\t\ttableCol.ColType = &quot;TIMESTAMP&quot; \t\t\t\tdefault: \t\t\t\t\tlog.Panicf(&quot;Field type %s not supported&quot;, fieldType) \t\t\t\t} \t\t\t} \t\t\ttableCol.FieldType = fieldType \t\t\tcurTable.Columns = append(curTable.Columns, tableCol) \t\t\tcurTable.StructName = currType.Name.Name  \t\t} \t\tcurTable.generateCreateTable(out)  \t\tfmt.Printf(&quot;\\tgenerating CRUD methods for %s\\n&quot;, currType.Name.Name) \t\tcurTable.generateCreate(out) \t\tcurTable.generateQuery(out) \t\tcurTable.generateUpdate(out) \t\tcurTable.generateDelete(out) \t} }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044f\u043c \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u0442\u0435\u0433\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0441 \u0442\u0435\u0433 (\u0432\u0435\u0434\u044c \u043d\u0430 \u043f\u043e\u043b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u0433\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f json). \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0442\u0435\u0433\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u043e\u043b\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c (\u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u0440\u0443\u0433\u043d\u0435\u043c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435), \u0435\u0441\u0442\u044c \u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0411\u0414 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043c\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0442\u0435\u0433\u0435. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 \u043f\u043e\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0422\u0438\u043f\u043e\u0432 \u043f\u043e\u043b\u0435\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0431\u0443\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0441\u0435 \u0441\u0432\u0435\u0434\u0435\u043c \u0432 \u0442\u0438\u043f \u043f\u043e\u043b\u044f TEXT, \u0445\u043e\u0442\u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0442\u0435\u0433\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u043e. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0431\u0430\u0437\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u043b\u0438\u0431\u043e \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 Create, Query, Update, Delete. \u041c\u044b \u0433\u043e\u0442\u043e\u0432\u0438\u043c SQL \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043e\u0431\u0432\u044f\u0437\u043a\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0421 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435 \u0441\u0442\u0430\u043b \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0434\u0430\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0411\u0414. \u0414\u043b\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 text\/template. \u0421 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 (\u043a\u043e\u0434 \u0432\u0438\u0434\u0435\u043d \u0441\u0440\u0430\u0437\u0443, \u0430 \u043d\u0435 \u0440\u0430\u0437\u043c\u0430\u0437\u0430\u043d \u043f\u043e \u043a\u043e\u0434\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func (tableD *TableInfo) generateCreateTable(out *os.File) error { \tfmt.Fprint(out, &quot;func (in *&quot;+tableD.StructName+&quot;) createTable(db *sql.DB) (error) {\\n&quot;) \tvar resSQLq = fmt.Sprintf(&quot;\\tsqlQ := `CREATE TABLE %s (\\n&quot;, tableD.TableName) \tfor _, col := range tableD.Columns { \t\tcolSQL := col.ColName + &quot; &quot; + col.ColType \t\tif col.NotNull { \t\t\tcolSQL += &quot; NOT NULL&quot; \t\t} \t\tif col == tableD.PrimaryKey { \t\t\tcolSQL += &quot; AUTO_INCREMENT&quot; \t\t} \t\tcolSQL += &quot;,\\n&quot; \t\tresSQLq += colSQL \t} \tif tableD.PrimaryKey != nil { \t\tresSQLq += fmt.Sprintf(&quot;PRIMARY KEY (%s)\\n&quot;, tableD.PrimaryKey.ColName) \t} \tresSQLq += &quot;)`\\n&quot; \tfmt.Fprint(out, resSQLq) \tfmt.Fprint(out, &quot;\\t_, err := db.Exec(sqlQ)\\n\\t\\tif err != nil {\\n\\t\\t\\treturn err\\n\\t\\t}\\n&quot;) \tfmt.Fprint(out, &quot;\\t return nil\\n}\\n\\n&quot;) \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">  \tfmt.Fprint(out, &quot;func (in *&quot;+tableD.StructName+&quot;) Create(db *sql.DB) (error) {\\n&quot;) \tvar columns, valuePlaces, valuesListParams string \tfor _, col := range tableD.Columns { \t\tif col == tableD.PrimaryKey { \t\t\tcontinue \t\t} \t\tcolumns += &quot;`&quot; + col.ColName + &quot;`,&quot; \t\tvaluePlaces += &quot;?,&quot; \t\tvaluesListParams += &quot;in.&quot; + col.FieldName + &quot;,&quot; \t} \tcolumns = columns[:len(columns)-1] \tvaluePlaces = valuePlaces[:len(valuePlaces)-1] \tvaluesListParams = valuesListParams[:len(valuesListParams)-1]  \tresSQLq := fmt.Sprintf(&quot;\\tsqlQ := \\&quot;INSERT INTO %s (%s) VALUES (%s);\\&quot;\\n&quot;, \t\ttableD.TableName, \t\tcolumns, \t\tvaluePlaces) \tfmt.Fprintln(out, resSQLq) \tfmt.Fprintf(out, &quot;result, err := db.Exec(sqlQ, %s)\\n&quot;, valuesListParams) \tfmt.Fprintln(out, `if err != nil { \t\treturn err \t}`) \t\/\/Setting id if we have primary key \tif tableD.PrimaryKey != nil { \t\tfmt.Fprintf(out, `lastId, err := result.LastInsertId() \t\tif err != nil { \t\t\treturn nil \t\t}`) \t\tfmt.Fprintf(out, &quot;\\nin.%s = %s(lastId)\\n&quot;, tableD.PrimaryKey.FieldName, tableD.PrimaryKey.FieldType) \t} \tfmt.Fprintln(out, &quot;return nil\\n}\\n\\n&quot;) \t\/\/in., _ := result.LastInsertId()`) \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func (tableD *TableInfo) generateQuery(out *os.File) error { \tfmt.Fprint(out, &quot;func (in *&quot;+tableD.StructName+&quot;) Query(db *sql.DB) ([]*&quot;+tableD.StructName+&quot;, error) {\\n&quot;)  \tfmt.Fprintf(out, &quot;\\tsqlQ := \\&quot;SELECT * FROM %s;\\&quot;\\n&quot;, tableD.TableName) \tfmt.Fprintf(out, &quot;rows, err := db.Query(sqlQ)\\n&quot;) \tfmt.Fprintf(out, &quot;results := make([]*%s, 0)\\n&quot;, tableD.StructName) \tfmt.Fprintf(out, `for rows.Next() {`) \tfmt.Fprintf(out, &quot;\\t tempR := &%s{}\\n&quot;, tableD.StructName) \tvar valuesListParams string \tfor _, col := range tableD.Columns { \t\tvaluesListParams += &quot;&tempR.&quot; + col.FieldName + &quot;,&quot; \t} \tvaluesListParams = valuesListParams[:len(valuesListParams)-1]  \tfmt.Fprintf(out, &quot;\\terr = rows.Scan(%s)\\n&quot;, valuesListParams) \tfmt.Fprintf(out, `if err != nil { \t\treturn nil, err \t\t}`) \tfmt.Fprintf(out, &quot;\\n\\tresults = append(results, tempR)&quot;) \tfmt.Fprintf(out, `} \t\treturn results, nil \t}`) \tfmt.Fprintln(out, &quot;&quot;) \tfmt.Fprintln(out, &quot;&quot;) \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e primary key)<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func (tableD *TableInfo) generateUpdate(out *os.File) error { \tfmt.Fprint(out, &quot;func (in *&quot;+tableD.StructName+&quot;) Update(db *sql.DB) (error) {\\n&quot;) \tvar updVals, valuesListParams string \tfor _, col := range tableD.Columns { \t\tif col == tableD.PrimaryKey { \t\t\tcontinue \t\t} \t\tupdVals += &quot;`&quot; + col.ColName + &quot;`=?,&quot; \t\tvaluesListParams += &quot;in.&quot; + col.FieldName + &quot;,&quot; \t} \tupdVals = updVals[:len(updVals)-1] \tvaluesListParams += &quot;in.&quot; + tableD.PrimaryKey.FieldName  \tresSQLq := fmt.Sprintf(&quot;\\tsqlQ := \\&quot;UPDATE %s SET %s WHERE %s = ?;\\&quot;\\n&quot;, \t\ttableD.TableName, \t\tupdVals, \t\ttableD.PrimaryKey.ColName) \tfmt.Fprintln(out, resSQLq) \tfmt.Fprintf(out, &quot;_, err := db.Exec(sqlQ, %s)\\n&quot;, valuesListParams) \tfmt.Fprintln(out, `if err != nil { \t\treturn err \t}`)  \tfmt.Fprintln(out, &quot;return nil\\n}\\n\\n&quot;) \t\/\/in., _ := result.LastInsertId()`) \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e primary key)<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> func (tableD *TableInfo) generateDelete(out *os.File) error { \tfmt.Fprint(out, &quot;func (in *&quot;+tableD.StructName+&quot;) Delete(db *sql.DB) (error) {\\n&quot;) \tfmt.Fprintf(out, &quot;sqlQ := \\&quot;DELETE FROM %s WHERE id = ?\\&quot;\\n&quot;, tableD.TableName)  \tfmt.Fprintf(out, &quot;_, err := db.Exec(sqlQ, in.%s)\\n&quot;, tableD.PrimaryKey.FieldName)  \tfmt.Fprintln(out, `if err != nil { \t\treturn err \t} \treturn nil }`) \tfmt.Fprintln(out) \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c go run, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0444\u043b\u0430\u0433 -name \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c _dbe, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"go\"> \/\/ dbe:{&quot;table&quot;: &quot;users&quot;} type User struct { \tID       int    `dbe:&quot;id,primary_key&quot;` \tLogin    string `dbe:&quot;login,not_null&quot;` \tEmail    string \tLevel    uint8 \tIsActive bool \tUError   error `dbe:&quot;-&quot;` } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> package main  import &quot;database\/sql&quot;  func (in *User) createTable(db *sql.DB) error { \tsqlQ := `CREATE TABLE users ( \tid integer NOT NULL AUTO_INCREMENT, \tlogin text NOT NULL, \tEmail text, \tLevel integer, \tIsActive boolean, \tPRIMARY KEY (id) \t)` \t_, err := db.Exec(sqlQ) \tif err != nil { \t\treturn err \t} \treturn nil }  func (in *User) Create(db *sql.DB) error { \tsqlQ := &quot;INSERT INTO users (`login`,`Email`,`Level`,`IsActive`) VALUES (?,?,?,?);&quot;  \tresult, err := db.Exec(sqlQ, in.Login, in.Email, in.Level, in.IsActive) \tif err != nil { \t\treturn err \t} \tlastId, err := result.LastInsertId() \tif err != nil { \t\treturn nil \t} \tin.ID = int(lastId) \treturn nil }  func (in *User) Query(db *sql.DB) ([]*User, error) { \tsqlQ := &quot;SELECT * FROM users;&quot; \trows, err := db.Query(sqlQ) \tresults := make([]*User, 0) \tfor rows.Next() { \t\ttempR := &User{} \t\terr = rows.Scan(&tempR.ID, &tempR.Login, &tempR.Email, &tempR.Level, &tempR.IsActive) \t\tif err != nil { \t\t\treturn nil, err \t\t} \t\tresults = append(results, tempR) \t} \treturn results, nil }  func (in *User) Update(db *sql.DB) error { \tsqlQ := &quot;UPDATE users SET `login`=?,`Email`=?,`Level`=?,`IsActive`=? WHERE id = ?;&quot;  \t_, err := db.Exec(sqlQ, in.Login, in.Email, in.Level, in.IsActive, in.ID) \tif err != nil { \t\treturn err \t} \treturn nil }  func (in *User) Delete(db *sql.DB) error { \tsqlQ := &quot;DELETE FROM users WHERE id = ?&quot; \t_, err := db.Exec(sqlQ, in.ID) \tif err != nil { \t\treturn err \t} \treturn nil } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 (\u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0431\u0430\u0437\u0435, \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430). \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0437\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\"> var err error db, err := sql.Open(&quot;mysql&quot;, DSN) if err != nil { \tfmt.Println(&quot;Unable to connect to DB&quot;, err) \treturn } err = db.Ping() if err != nil { \tfmt.Println(&quot;Unable to ping BD&quot;) \treturn } newUser := &User{ \tLogin:    &quot;newUser&quot;, \tEmail:    &quot;new@test.com&quot;, \tLevel:    0, \tIsActive: false, \tUError:   nil, }  err = newUser.createTable(db) if err != nil { \tfmt.Println(&quot;Error creating table.&quot;, err)  } err = newUser.Create(db) if err != nil { \tfmt.Println(&quot;Error creating user.&quot;, err) \treturn }  nU := &User{} dbUsers, err := nU.Query(db) if err != nil { \tfmt.Println(&quot;Error selecting users.&quot;, err) \treturn } fmt.Printf(&quot;From table users selected %d fields&quot;, len(dbUsers)) var DBUser *User for _, user := range dbUsers { \tfmt.Println(user) \tDBUser = user } DBUser.Level = 2 err = DBUser.Update(db) if err != nil { \tfmt.Println(&quot;Error updating users.&quot;, err) \treturn } err = DBUser.Delete(db) if err != nil { \tfmt.Println(&quot;Error deleting users.&quot;, err) \treturn } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0411\u0414 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d:<\/p>\n<ul>\n<li>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e MySQL;<\/li>\n<li>\u043d\u0435 \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f;<\/li>\n<li>\u0434\u043b\u044f SELECT \u043d\u0435\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u043b\u0438\u043c\u0438\u0442\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0434\u043e\u0447\u0435\u0442\u043e\u0432 \u0443\u0436\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 Go \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u043b\u044f \u0438 \u0442\u0438\u043f\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0411\u0414, \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430. \u0414\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438, \u043d\u043e \u044d\u0442\u043e \u0431\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/AlhimicMan\/dbgormen\">Github<\/a>.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/501000\/\"> https:\/\/habr.com\/ru\/post\/501000\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/501000\/\">\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 Golang. \u0417\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u043f\u043e Go \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0440\u043d\u044b\u0435 \u0441\u043f\u043e\u0440\u044b. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0430\u043b\u043e, \u0445\u043e\u0442\u044f \u043e\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 Go. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0444\u0435\u0440\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u043e\u0431\u043e\u0439\u0434\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 \u0438 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303193","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=303193"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303193\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}