{"id":52791,"date":"2024-12-03T09:33:43","date_gmt":"2024-12-03T01:33:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52791\/"},"modified":"2024-12-03T09:33:43","modified_gmt":"2024-12-03T01:33:43","slug":"vue-%e9%a1%b9%e7%9b%ae%e4%b8%ad%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-clickhouse-js-%e8%bf%9b%e8%a1%8c%e5%a2%9e%e5%88%a0%e6%94%b9%e6%9f%a5%e6%93%8d%e4%bd%9c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52791\/","title":{"rendered":"Vue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Vue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f<\/h1>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300aVue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/1732347028674184944515b.jpg\" class=\"aligncenter\" title=\"Vue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f\u63d2\u56fe\" alt=\"Vue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>vue\u9879\u76ee\u4e2d\u4f7f\u7528clickhouse js<\/strong><\/p>\n<p>\u5bf9\u4e8e\u521d\u6b21\u4f7f\u7528clickhouse js\u7684\u5927\u4f6c\u6765\u8bf4\uff0c\u5728vue\u9879\u76ee\u4e2d\u8fde\u63a5\u6570\u636e\u5e93\u5e76\u6267\u884c\u589e\u5220\u6539\u67e5\u53ef\u80fd\u662f\u4e00\u4e2a\u96be\u9898\u3002<\/p>\n<p><strong>\u5c01\u88c5<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u4e3a\u65b9\u4fbf\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5c01\u88c5\u4e00\u4e2aclickhouse js\u5ba2\u6237\u7aef\u3002<\/p>\n<p><strong>\u8fde\u63a5\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u4f7f\u7528\u8fde\u63a5\u65b9\u6cd5\u8fde\u63a5\u5230clickhouse\u6570\u636e\u5e93\uff1a<\/p>\n<pre>const clickhouse = require('clickhouse');\nconst client = clickhouse.createclient({\n  \/\/ \u586b\u5199\u60a8\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\n});<\/pre>\n<p><strong>\u67e5\u8be2\u6570\u636e<\/strong><\/p>\n<p>\u4f7f\u7528query()\u65b9\u6cd5\u6267\u884c\u67e5\u8be2\u8bed\u53e5\uff1a<\/p>\n<pre>client.query('select * from table').then(res =&gt; {\n  \/\/ \u5904\u7406\u67e5\u8be2\u7ed3\u679c\n});<\/pre>\n<p><strong>\u63d2\u5165\u6570\u636e<\/strong><\/p>\n<p>\u4f7f\u7528insert()\u65b9\u6cd5\u63d2\u5165\u6570\u636e\uff1a<\/p>\n<pre>client.insert('table', { name: 'john', age: 30 }).then(() =&gt; {\n  \/\/ insert \u64cd\u4f5c\u6210\u529f\n});<\/pre>\n<p><strong>\u66f4\u65b0\u6570\u636e<\/strong><\/p>\n<p>\u4f7f\u7528update()\u65b9\u6cd5\u66f4\u65b0\u6570\u636e\uff1a<\/p>\n<pre>client.update('table', { id: 1, name: 'jane' }).then(() =&gt; {\n  \/\/ update \u64cd\u4f5c\u6210\u529f\n});<\/pre>\n<p><strong>\u5220\u9664\u6570\u636e<\/strong><\/p>\n<p>\u4f7f\u7528delete()\u65b9\u6cd5\u5220\u9664\u6570\u636e\uff1a<\/p>\n<pre>client.delete('table', { id: 1 }).then(() =&gt; {\n  \/\/ Delete \u64cd\u4f5c\u6210\u529f\n});<\/pre>\n<p>\u4eca\u5929\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff1b\u5173\u4e8e\u6587\u7ae0\u7684\u6280\u672f\u77e5\u8bc6\u6211\u4eec\u4f1a\u4e00\u70b9\u70b9\u6df1\u5165\u4ecb\u7ecd\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u4e00\u8d77\u5b66\u4e60\u7f16\u7a0b~<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u9875\u9762\u5173\u95ed\u65f6 AJAX \u8bf7\u6c42\u4e0d\u751f\u6548\u600e\u4e48\u529e\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Vue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f \u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300aVue \u9879\u76ee\u4e2d\u5982\u4f55\u4f7f\u7528 ClickHouse JS \u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff1f\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 vue\u9879\u76ee\u4e2d\u4f7f\u7528clickhouse js \u5bf9\u4e8e\u521d\u6b21\u4f7f\u7528clickhouse js\u7684\u5927\u4f6c\u6765\u8bf4\uff0c\u5728vue\u9879\u76ee\u4e2d\u8fde\u63a5\u6570\u636e\u5e93\u5e76\u6267\u884c\u589e\u5220\u6539\u67e5\u53ef\u80fd\u662f\u4e00\u4e2a\u96be\u9898\u3002 \u5c01\u88c5 \u9996\u5148\uff0c\u4e3a\u65b9\u4fbf\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5c01\u88c5\u4e00\u4e2aclickhouse js\u5ba2\u6237\u7aef\u3002 \u8fde\u63a5\u6570\u636e\u5e93 \u4f7f\u7528\u8fde\u63a5\u65b9\u6cd5\u8fde\u63a5\u5230clickhouse\u6570\u636e\u5e93\uff1a const clickhouse = require(&#8216;clickhouse&#8217;); const client = clickhouse.createclient({ \/\/ \u586b\u5199\u60a8\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f }); \u67e5\u8be2\u6570\u636e \u4f7f\u7528query()\u65b9\u6cd5\u6267\u884c\u67e5\u8be2\u8bed\u53e5\uff1a client.query(&#8216;select * from table&#8217;).then(res =&gt; { \/\/ \u5904\u7406\u67e5\u8be2\u7ed3\u679c }); \u63d2\u5165\u6570\u636e \u4f7f\u7528insert()\u65b9\u6cd5\u63d2\u5165\u6570\u636e\uff1a client.insert(&#8216;table&#8217;, { name: &#8216;john&#8217;, age: 30 }).then(() =&gt; { \/\/ insert \u64cd\u4f5c\u6210\u529f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52791","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52791"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52791\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}