{"id":304261,"date":"2020-05-26T09:01:06","date_gmt":"2020-05-26T09:01:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=304261"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=304261","title":{"rendered":"\u0420\u0435\u0446\u0435\u043f\u0442\u044b PostgreSQL: \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 mustach"},"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\/503832\/\">\u0414\u043b\u044f \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/RekGRpth\/pg_mustach\" rel=\"nofollow\">\u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 mustach<\/a> \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <a href=\"https:\/\/www.postgresql.org\" rel=\"nofollow\">postgres<\/a> \u0438 <a href=\"https:\/\/gitlab.com\/jobol\/mustach\" rel=\"nofollow\">mustach<\/a>. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/hub.docker.com\/r\/rekgrpth\/postgres\" rel=\"nofollow\">\u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/a>.<\/p>\n<p>  \u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435? \u041d\u0443, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435, \u0442\u043e \u0438 \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 \u0431\u0430\u0437\u0435. \u0410 \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u0431\u0430\u0437\u0435? \u0414\u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0441\u0442\u044c \u0432 \u0431\u0430\u0437\u0435 \u0435\u0441\u0442\u044c \u0441\u0447\u0435\u0442\u0430 (\u044d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435). \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u044f\u0446\u0435 \u0441\u0443\u043c\u043c\u0430 \u043e\u0434\u043d\u0430, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u2014 \u0434\u0440\u0443\u0433\u0430\u044f, \u043f\u043e\u0442\u043e\u043c \u2014 \u0442\u0440\u0435\u0442\u044c\u044f \u0438 \u0442.\u0434. \u041d\u043e \u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0447\u0451\u0442\u0430 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0434\u0443 \u043e\u0434\u0438\u043d, \u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 (\u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c 20% ). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0435. \u041d\u0443 \u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c (\u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435) <a href=\"https:\/\/habr.com\/ru\/post\/458986\/\">\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 pdf<\/a> \u0438 (\u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435) <a href=\"https:\/\/habr.com\/ru\/post\/456736\/\">\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 email<\/a>. \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/habr.com\/ru\/post\/456722\/\">\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430<\/a>.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0435\u0433\u043e \u0432\u0435\u0441\u044c (\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432) <\/p>\n<pre><code class=\"cpp\">#include &lt;postgres.h&gt; \/\/ \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438.  #include &lt;catalog\/pg_type.h&gt; \/\/ \u0438 \u0435\u0449\u0451 extern text *cstring_to_text(const char *s); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f extern text *cstring_to_text_with_len(const char *s, int len); \/\/ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 extern char *text_to_cstring(const text *t); \/\/ \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e,  extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len); \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 #define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s)) \/\/ \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 #define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d)) \/\/ \u0441 \u0438\u043c\u0435\u043d\u0435\u043c json_object #include &lt;mustach\/mustach-json-c.h&gt; \/\/ \u0432\u043e\u0442 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430  #define EXTENSION(function) Datum (function)(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(function); Datum (function)(PG_FUNCTION_ARGS) \/\/ \u043c\u0430\u043a\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f  PG_MODULE_MAGIC; \/\/ \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f  EXTENSION(json2mustach) { \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438      char *file; \/\/ \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430     char *json; \/\/ \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438     char *output_data; \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438     char *template; \/\/ \u0448\u0430\u0431\u043b\u043e\u043d     enum json_tokener_error error; \/\/ \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u0430     FILE *out; \/\/ \u0444\u0430\u0439\u043b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430     size_t output_len; \/\/ \u0440\u0430\u0437\u043c\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438     struct json_object *object; \/\/ \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0430\u0440\u0441\u0435\u0440\u0430     text *output; \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442     if (PG_ARGISNULL(0)) ereport(ERROR, (errmsg(&quot;json is null!&quot;))); \/\/ \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c NULL     if (PG_ARGISNULL(1)) ereport(ERROR, (errmsg(&quot;template is null!&quot;))); \/\/ \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 - \u0442\u043e\u0436\u0435     json = TextDatumGetCString(PG_GETARG_DATUM(0)); \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c C-\u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430     template = TextDatumGetCString(PG_GETARG_DATUM(1)); \/\/ \u0438 \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e     if (!(object = json_tokener_parse_verbose(json, &amp;error))) ereport(ERROR, (errmsg(&quot;!json_tokener_parse and %s&quot;, json_tokener_error_desc(error)))); \/\/ \u043f\u0430\u0440\u0441\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c     switch (PG_NARGS()) { \/\/ \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432         case 2: if (!(out = open_memstream(&amp;output_data, &amp;output_len))) ereport(ERROR, (errmsg(&quot;!open_memstream&quot;))); break; \/\/ \u043f\u0440\u0438 \u0434\u0432\u0443\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438         case 3: \/\/ \u043f\u0440\u0438 \u0442\u0440\u0451\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445             if (PG_ARGISNULL(2)) ereport(ERROR, (errmsg(&quot;file is null!&quot;))); \/\/ \u0442\u0440\u0435\u0442\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c NULL             file = TextDatumGetCString(PG_GETARG_DATUM(2)); \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c C-\u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430             if (!(out = fopen(file, &quot;wb&quot;))) ereport(ERROR, (errmsg(&quot;!fopen&quot;))); \/\/ \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0438 \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c             pfree(file); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c             break; \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c         default: ereport(ERROR, (errmsg(&quot;expect be 2 or 3 args&quot;))); \/\/ \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u043b\u0438 \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430      }     if (fmustach_json_c(template, object, out)) ereport(ERROR, (errmsg(&quot;fmustach_json_c&quot;))); \/\/ \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c     pfree(json); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c     pfree(template); \/\/ \u0438 \u0435\u0449\u0451     if (!json_object_put(object)) ereport(ERROR, (errmsg(&quot;!json_object_put&quot;))); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440\u0430     switch (PG_NARGS()) { \/\/ \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432         case 2: \/\/ \u043f\u0440\u0438 \u0434\u0432\u0443\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445             fclose(out); \/\/ \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438             output = cstring_to_text_with_len(output_data, output_len); \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430             free(output_data); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c             PG_RETURN_TEXT_P(output); \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442             break; \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c         case 3: PG_RETURN_BOOL(true); break; \/\/ \u043f\u0440\u0438 \u0442\u0440\u0451\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0443\u0441\u043f\u0435\u0445         default: ereport(ERROR, (errmsg(&quot;expect be 2 or 3 args&quot;))); \/\/ \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u043b\u0438 \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430      } } <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u043e \u0442\u0430\u043a: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <\/p>\n<pre><code class=\"sql\">create extension pg_mustach<\/code><\/pre>\n<p>  \u0430 \u043f\u043e\u0442\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u044c <\/p>\n<pre><code class=\"sql\">select json2mustach('{&quot;name&quot;:&quot;\u041c\u0438\u0440&quot;}', '\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, {{name}}!')<\/code><\/pre>\n<p>   \u0438\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b <\/p>\n<pre><code class=\"sql\">select json2mustach('{&quot;name&quot;:&quot;\u041c\u0438\u0440&quot;}', '\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, {{name}}!', 'file_name')<\/code><\/pre>\n<\/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\/503832\/\"> https:\/\/habr.com\/ru\/post\/503832\/<\/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\/503832\/\">\u0414\u043b\u044f \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/RekGRpth\/pg_mustach\" rel=\"nofollow\">\u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 mustach<\/a> \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <a href=\"https:\/\/www.postgresql.org\" rel=\"nofollow\">postgres<\/a> \u0438 <a href=\"https:\/\/gitlab.com\/jobol\/mustach\" rel=\"nofollow\">mustach<\/a>. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/hub.docker.com\/r\/rekgrpth\/postgres\" rel=\"nofollow\">\u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/a>.<\/p>\n<p>  \u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435? \u041d\u0443, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435, \u0442\u043e \u0438 \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 \u0431\u0430\u0437\u0435. \u0410 \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u0431\u0430\u0437\u0435? \u0414\u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0441\u0442\u044c \u0432 \u0431\u0430\u0437\u0435 \u0435\u0441\u0442\u044c \u0441\u0447\u0435\u0442\u0430 (\u044d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435). \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u044f\u0446\u0435 \u0441\u0443\u043c\u043c\u0430 \u043e\u0434\u043d\u0430, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u2014 \u0434\u0440\u0443\u0433\u0430\u044f, \u043f\u043e\u0442\u043e\u043c \u2014 \u0442\u0440\u0435\u0442\u044c\u044f \u0438 \u0442.\u0434. \u041d\u043e \u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0447\u0451\u0442\u0430 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0434\u0443 \u043e\u0434\u0438\u043d, \u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 (\u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c 20% ). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0435. \u041d\u0443 \u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0431\u0430\u0437\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c (\u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435) <a href=\"https:\/\/habr.com\/ru\/post\/458986\/\">\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 pdf<\/a> \u0438 (\u0442\u0443\u0442 \u0436\u0435 \u0432 \u0431\u0430\u0437\u0435) <a href=\"https:\/\/habr.com\/ru\/post\/456736\/\">\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 email<\/a>. \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/habr.com\/ru\/post\/456722\/\">\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430<\/a>.  <\/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-304261","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304261","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=304261"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304261\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}