{"id":92582,"date":"2026-08-10T17:24:47","date_gmt":"2026-08-10T09:24:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/92582.html"},"modified":"2026-08-10T17:24:47","modified_gmt":"2026-08-10T09:24:47","slug":"go-orm-%e6%a1%86%e6%9e%b6%e9%80%89%e5%9e%8b%ef%bc%9agorm%e3%80%81ent-%e5%92%8c-sqlc-%e5%90%84%e8%87%aa%e9%80%82%e5%90%88%e4%bb%80%e4%b9%88%e5%9c%ba%e6%99%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/92582.html","title":{"rendered":"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f"},"content":{"rendered":"<h2>Go ORM \u6846\u67b6\u9009\u578b&#xff1a;GORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f<\/h2>\n<h3>\u4e00\u3001\u4ece&#034;\u80fd\u7528&#034;\u5230&#034;\u4e0d\u51fa\u4e8b&#034;&#xff1a;ORM \u9009\u578b\u88ab\u4f4e\u4f30\u7684\u5de5\u7a0b\u5f71\u54cd<\/h3>\n<p>Go \u751f\u6001\u7684 ORM \u9009\u578b\u4e0d\u50cf Java \u90a3\u6837\u6709\u4e00\u4e2a Hibernate \u7ea7\u522b\u7684&#034;\u6807\u51c6\u7b54\u6848&#034;\u3002GORM \u7528\u6237\u57fa\u6570\u6700\u5927&#xff0c;Ent \u6765\u81ea Facebook \u7684\u5b9e\u8df5\u6c89\u6dc0&#xff0c;sqlc \u5219\u4ee3\u8868\u4e86\u53e6\u4e00\u79cd\u6d41\u6d3e\u2014\u2014\u76f4\u63a5\u4ece SQL \u751f\u6210\u7c7b\u578b\u5b89\u5168\u7684 Go \u4ee3\u7801\u3002\u4e09\u8005\u7684\u8bbe\u8ba1\u7406\u5ff5\u5dee\u5f02\u4e0d\u662f&#034;\u8c01\u66f4\u597d&#034;\u7684\u95ee\u9898&#xff0c;\u800c\u662f&#034;\u8c01\u7684\u5047\u8bbe\u66f4\u5339\u914d\u4f60\u7684\u9879\u76ee&#034;\u7684\u95ee\u9898\u3002<\/p>\n<p>\u5f88\u591a\u56e2\u961f\u5728\u6280\u672f\u9009\u578b\u65f6\u53ea\u5173\u6ce8&#034;\u597d\u4e0d\u597d\u5199&#034;&#xff0c;\u5ffd\u7565\u4e86\u4e24\u4e2a\u66f4\u91cd\u8981\u7684\u7ef4\u5ea6&#xff1a;\u51fa\u95ee\u9898\u65f6\u6392\u67e5\u96be\u5ea6\u3001\u957f\u671f\u7ef4\u62a4\u7684\u4ee3\u7801\u8150\u5316\u901f\u5ea6\u3002ORM \u751f\u6210\u7684\u90a3\u4e9b\u9690\u5f0f SQL&#xff0c;\u6700\u7ec8\u4f1a\u5728\u51cc\u6668\u4e09\u70b9\u7684 oncall \u4e2d\u53d8\u6210\u8c03\u8bd5\u5669\u68a6\u3002\u672c\u6587\u4ece\u5de5\u7a0b\u5b9e\u8df5\u7684\u89d2\u5ea6&#xff0c;\u5206\u6790\u4e09\u4e2a\u6846\u67b6\u7684\u53d6\u820d\u903b\u8f91\u3002<\/p>\n<h3>\u4e8c\u3001\u8fd0\u884c\u65f6\u53cd\u5c04 vs \u7f16\u8bd1\u65f6\u751f\u6210 vs SQL \u4f18\u5148&#xff1a;\u4e09\u6761\u8def\u7ebf\u7684\u67b6\u6784\u5206\u5316<\/h3>\n<p>GORM \u7684\u8fd0\u884c\u65f6\u53cd\u5c04&#xff1a;\u5f00\u53d1\u8005\u5b9a\u4e49 Go struct \u548c gorm tag&#xff0c;\u6846\u67b6\u5728\u8fd0\u884c\u65f6\u901a\u8fc7\u53cd\u5c04\u89e3\u6790\u5b57\u6bb5\u5173\u7cfb\u5e76\u6784\u5efa SQL\u3002\u4f18\u70b9\u662f\u4e0a\u624b\u5feb\u3001\u4ee3\u7801\u91cf\u5c11&#xff0c;\u7f3a\u70b9\u662f\u7c7b\u578b\u5b89\u5168\u4f9d\u8d56\u8fd0\u884c\u65f6&#xff0c;\u7f16\u8bd1\u671f\u65e0\u6cd5\u53d1\u73b0 SQL \u76f8\u5173\u9519\u8bef\u3002\u5f53\u4f60\u5199 db.Where(&#034;name &#061; ?&#034;, name).Find(&amp;users) \u65f6&#xff0c;\u5982\u679c name \u5b57\u6bb5\u5728 users \u8868\u4e2d\u4e0d\u5b58\u5728&#xff0c;\u7f16\u8bd1\u5668\u4e0d\u4f1a\u62a5\u4efb\u4f55\u9519\u8bef\u3002<\/p>\n<p>Ent \u7684 Schema \u751f\u6210\u4ee3\u7801&#xff1a;\u5f00\u53d1\u8005\u5728 ent\/schema \u76ee\u5f55\u4e0b\u5b9a\u4e49\u5b9e\u4f53\u6a21\u578b&#xff0c;\u8fd0\u884c go generate \u751f\u6210\u7c7b\u578b\u5b89\u5168\u7684 Builder \u4ee3\u7801\u3002\u7f16\u8bd1\u671f\u5c31\u80fd\u6821\u9a8c\u5b57\u6bb5\u5b58\u5728\u6027\u3001\u5173\u8054\u5173\u7cfb\u6b63\u786e\u6027\u3002\u4ee3\u4ef7\u662f\u4ee3\u7801\u751f\u6210\u91cf\u5de8\u5927&#xff0c;\u4e00\u4e2a\u4e2d\u7b49\u590d\u6742\u5ea6\u7684 schema \u76ee\u5f55\u53ef\u80fd\u4ea7\u751f\u4e0a\u4e07\u884c\u751f\u6210\u4ee3\u7801\u3002<\/p>\n<p>sqlc \u7684 SQL \u4f18\u5148&#xff1a;\u5f00\u53d1\u8005\u5728 .sql \u6587\u4ef6\u4e2d\u624b\u5199\u67e5\u8be2\u8bed\u53e5&#xff0c;sqlc \u89e3\u6790 SQL \u5e76\u751f\u6210\u5bf9\u5e94\u7684 Go \u51fd\u6570\u548c\u7c7b\u578b\u3002\u5b83\u662f\u552f\u4e00\u5728\u5f00\u53d1\u9636\u6bb5\u5c31\u80fd\u786e\u5b9a\u6700\u7ec8\u6267\u884c SQL \u7684\u65b9\u6848\u2014\u2014\u6570\u636e\u5e93\u6267\u884c\u4ec0\u4e48 SQL&#xff0c;\u4ee3\u7801\u91cc\u5199\u7684 SQL \u6587\u4ef6\u5c31\u662f\u4ec0\u4e48 SQL\u3002<\/p>\n<h3>\u4e09\u3001\u751f\u4ea7\u73af\u5883\u4e0b\u7684\u5173\u952e\u6570\u636e\u5bf9\u6bd4<\/h3>\n<h4>3.1 \u67e5\u8be2\u6027\u80fd\u57fa\u51c6<\/h4>\n<p>\u6d4b\u8bd5\u73af\u5883&#xff1a;Go 1.22&#xff0c;PostgreSQL 16&#xff0c;\u67e5\u8be2\u4e00\u4e2a 10 \u4e07\u884c\u7684\u7528\u6237\u8868\u3002<\/p>\n<table>\n<tr>\u6846\u67b6\u7b80\u5355\u67e5\u8be2 (Single Row)\u5217\u8868\u67e5\u8be2 (Limit 100)\u8054\u8868\u67e5\u8be2 (3 \u8868 JOIN)\u6279\u91cf\u63d2\u5165 (1000 rows)<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">GORM<\/td>\n<td align=\"left\">0.42 ms<\/td>\n<td align=\"left\">1.85 ms<\/td>\n<td align=\"left\">4.20 ms<\/td>\n<td align=\"left\">28 ms<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Ent<\/td>\n<td align=\"left\">0.38 ms<\/td>\n<td align=\"left\">1.62 ms<\/td>\n<td align=\"left\">3.45 ms<\/td>\n<td align=\"left\">24 ms<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">sqlc<\/td>\n<td align=\"left\">0.35 ms<\/td>\n<td align=\"left\">1.48 ms<\/td>\n<td align=\"left\">3.12 ms<\/td>\n<td align=\"left\">22 ms<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">database\/sql<\/td>\n<td align=\"left\">0.32 ms<\/td>\n<td align=\"left\">1.40 ms<\/td>\n<td align=\"left\">2.95 ms<\/td>\n<td align=\"left\">20 ms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6570\u636e\u8bf4\u660e\u51e0\u4e2a\u73b0\u8c61&#xff1a;\u8fd0\u884c\u65f6\u53cd\u5c04\u7684 GORM \u5728\u6bcf\u6b21\u67e5\u8be2\u4e2d\u591a\u51fa\u7ea6 0.05-0.10ms \u7684\u53cd\u5c04\u5f00\u9500&#xff0c;\u5728\u7b80\u5355\u67e5\u8be2\u4e2d\u5360\u6bd4\u7ea6 15%\u3002\u8054\u8868\u67e5\u8be2\u4e2d\u5dee\u8ddd\u62c9\u5927&#xff0c;GORM \u7684\u5173\u8054\u9884\u52a0\u8f7d&#xff08;Preload&#xff09;\u673a\u5236\u989d\u5916\u4ea7\u751f N&#043;1 \u6b21\u6570\u636e\u5e93\u5f80\u8fd4&#xff0c;\u5982\u679c\u6ca1\u663e\u5f0f\u4f7f\u7528 Joins \u65b9\u6cd5\u7684\u8bdd\u3002sqlc \u6700\u63a5\u8fd1\u539f\u751f database\/sql \u7684\u6027\u80fd&#xff0c;\u56e0\u4e3a\u5b83\u751f\u6210\u7684\u4ee3\u7801\u672c\u8d28\u4e0a\u5c31\u662f\u624b\u5199 database\/sql \u4ee3\u7801\u7684\u81ea\u52a8\u5316\u7248\u672c\u3002<\/p>\n<h4>3.2 \u4ee3\u7801\u91cf\u4e0e\u7f16\u8bd1\u65f6\u95f4<\/h4>\n<table>\n<tr>\u6846\u67b6Schema \u5b9a\u4e49\u884c\u6570\u4e1a\u52a1\u5c42\u8c03\u7528\u884c\u6570\u7f16\u8bd1\u8017\u65f6\u589e\u91cf<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">GORM<\/td>\n<td align=\"left\">45<\/td>\n<td align=\"left\">8<\/td>\n<td align=\"left\">~0.3s<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Ent<\/td>\n<td align=\"left\">62<\/td>\n<td align=\"left\">12<\/td>\n<td align=\"left\">~2.1s&#xff08;\u542b\u4ee3\u7801\u751f\u6210&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">sqlc<\/td>\n<td align=\"left\">28 (SQL)<\/td>\n<td align=\"left\">5<\/td>\n<td align=\"left\">~0.5s&#xff08;\u542b\u4ee3\u7801\u751f\u6210&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f\u8fd9\u91cc\u7684&#034;\u8c03\u7528\u884c\u6570&#034;\u5dee\u5f02\u3002\u540c\u4e00\u4e2a\u590d\u6742\u67e5\u8be2\u2014\u2014\u67e5\u51fa\u7528\u6237\u53ca\u5176\u6700\u8fd1 10 \u6761\u8ba2\u5355\u3001\u6bcf\u6761\u8ba2\u5355\u7684\u8be6\u60c5\u2014\u2014GORM \u9700\u8981 .Preload(&#034;Orders.Details&#034;) \u5e76\u7528\u989d\u5916\u7684\u6761\u4ef6\u51fd\u6570&#xff0c;Ent \u53ef\u4ee5\u7528\u94fe\u5f0f .WithOrders().WithDetails()&#xff0c;sqlc \u9700\u8981\u624b\u5199\u5305\u542b CTE \u7684 SQL \u8bed\u53e5\u3002\u8868\u8fbe\u529b\u4e0a sqlc \u6700\u5f3a&#xff08;SQL \u7684\u8868\u8fbe\u4e0a\u9650\u5c31\u662f\u5b83\u7684\u4e0a\u9650&#xff09;&#xff0c;\u4f46\u5b66\u4e60\u548c\u8c03\u8bd5\u6210\u672c\u4e5f\u968f SQL \u590d\u6742\u5ea6\u4e0a\u5347\u3002<\/p>\n<h3>\u56db\u3001\u4e09\u4e2a\u6846\u67b6\u7684\u7981\u533a\u4e0e\u6700\u4f73\u8fb9\u754c<\/h3>\n<p>GORM \u7684\u7981\u533a&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u5176\u751f\u6210\u7684 SQL \u7f3a\u4e4f\u63a7\u5236\u6b32\u7684\u56e2\u961f\u4e0d\u5e94\u9009\u62e9 GORM\u3002\u67d0\u4e9b\u6761\u4ef6\u7ec4\u5408\u4e0b&#xff0c;GORM \u53ef\u80fd\u751f\u6210\u975e\u9884\u671f\u7684 JOIN \u903b\u8f91\u6216\u5168\u8868\u626b\u63cf\u3002\u751f\u4ea7\u73af\u5883\u4e2d\u5fc5\u987b\u642d\u914d DBQueryLogger \u8bb0\u5f55\u6240\u6709 SQL \u8bed\u53e5\u3002<\/li>\n<li>\u6027\u80fd\u654f\u611f\u7684\u670d\u52a1&#xff08;P99 \u5ef6\u8fdf &lt; 5ms&#xff09;\u4e0d\u9002\u5408 GORM\u3002\u53cd\u5c04\u5f00\u9500\u5728\u8fd9\u4e2a\u91cf\u7ea7\u4e0b\u4e0d\u518d\u662f\u53ef\u5ffd\u7565\u7684\u566a\u58f0\u3002<\/li>\n<li>\u5927\u91cf\u52a8\u6001\u6761\u4ef6\u67e5\u8be2\u7684\u573a\u666f&#xff08;\u62a5\u8868\u7cfb\u7edf\u3001\u7ba1\u7406\u540e\u53f0\u7b5b\u9009\u9762\u677f&#xff09;&#xff0c;GORM \u7684\u94fe\u5f0f\u8c03\u7528\u786e\u5b9e\u65b9\u4fbf\u3002\u8fd9\u662f\u5b83\u6700\u5408\u9002\u7684\u9635\u5730\u3002<\/li>\n<\/ul>\n<p>Ent \u7684\u7981\u533a&#xff1a;<\/p>\n<ul>\n<li>\u56e2\u961f\u4e0d\u613f\u610f\u63a5\u53d7\u4ee3\u7801\u751f\u6210\u5de5\u4f5c\u6d41\u7684\u4e0d\u8981\u9009 Ent\u3002\u6bcf\u6b21\u4fee\u6539 schema \u9700\u8981\u91cd\u65b0\u751f\u6210\u4ee3\u7801&#xff0c;PR \u4e2d\u51fa\u73b0\u4e0a\u5343\u884c\u81ea\u52a8\u751f\u6210\u4ee3\u7801\u7684 diff \u9700\u8981\u56e2\u961f\u4ece\u5fc3\u7406\u4e0a\u63a5\u53d7\u3002<\/li>\n<li>\u9879\u76ee\u8fed\u4ee3\u65e9\u671f\u3001\u6570\u636e\u6a21\u578b\u9891\u7e41\u53d8\u52a8\u65f6&#xff0c;Ent \u7684\u751f\u6210-\u4fee\u6539-\u518d\u751f\u6210\u5faa\u73af\u6709\u6469\u64e6\u6210\u672c\u3002<\/li>\n<li>\u591a\u5bf9\u591a\u5173\u7cfb\u590d\u6742\u3001\u9700\u8981\u5927\u91cf\u81ea\u5b9a\u4e49\u4e2d\u95f4\u8868\u7684\u573a\u666f&#xff0c;Ent \u7684 Edge \u5b9a\u4e49\u80fd\u529b\u7ec4\u5408\u5f97\u5f53\u53ef\u4ee5\u5e94\u5bf9&#xff0c;\u4f46\u5b66\u4e60\u66f2\u7ebf\u9661\u5ced\u3002<\/li>\n<\/ul>\n<p>sqlc \u7684\u7981\u533a&#xff1a;<\/p>\n<ul>\n<li>\u56e2\u961f\u6ca1\u6709 SQL \u9ad8\u624b\u7684\u60c5\u51b5\u4e0b&#xff0c;sqlc \u53cd\u800c\u653e\u5927\u4e86\u98ce\u9669\u2014\u2014\u4f60\u5199\u7684 SQL \u5c31\u662f\u6267\u884c\u7684 SQL&#xff0c;\u6ca1\u6709\u6846\u67b6\u5e2e\u4f60\u515c\u5e95\u3002<\/li>\n<li>\u5927\u91cf\u52a8\u6001\u67e5\u8be2&#xff08;\u5982\u7528\u6237\u53ef\u7ec4\u5408\u7684\u7b5b\u9009\u6761\u4ef6 &#034;WHERE a&#061;? AND b&#061;? OR c&#061;?&#034;&#xff09;&#xff0c;sqlc \u7684\u9759\u6001 SQL \u6587\u4ef6\u65b9\u5f0f\u5e94\u5bf9\u8d77\u6765\u4e0d\u5982 GORM \u7075\u6d3b\u3002<\/li>\n<li>\u9700\u8981\u8de8\u6570\u636e\u5e93&#xff08;\u5982\u540c\u65f6\u652f\u6301 MySQL \u548c PostgreSQL&#xff09;\u7684\u60c5\u51b5\u4e0b&#xff0c;sqlc \u7684 SQL \u65b9\u8a00\u5dee\u5f02\u4f1a\u8ba9\u7ef4\u62a4\u6210\u672c\u7ffb\u500d\u3002<\/li>\n<\/ul>\n<h3>\u7ed3\u8bba<\/h3>\n<p>\u9009\u578b\u51b3\u7b56\u53ef\u4ee5\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p>\u9009 GORM&#xff1a;\u56e2\u961f\u5feb\u901f\u4ea4\u4ed8\u4f18\u5148\u3001\u4e1a\u52a1\u903b\u8f91\u4ee5 CRUD \u4e3a\u4e3b\u3001\u5bf9\u53cd\u5c04\u5f00\u9500\u4e0d\u654f\u611f&#xff08;\u5ef6\u8fdf\u9884\u7b97 &gt; 10ms&#xff09;\u3002\u9009 Ent&#xff1a;\u4e2d\u578b\u5230\u5927\u578b\u9879\u76ee\u3001\u6570\u636e\u6a21\u578b\u7a33\u5b9a\u3001\u6ce8\u91cd\u7f16\u8bd1\u671f\u7c7b\u578b\u5b89\u5168\u3001\u56e2\u961f\u80fd\u63a5\u53d7\u4ee3\u7801\u751f\u6210\u8303\u5f0f\u3002\u9009 sqlc&#xff1a;\u56e2\u961f\u6709\u6570\u636e\u5e93\u4e13\u5bb6\u3001\u5bf9 SQL \u6267\u884c\u6709\u7cbe\u786e\u63a7\u5236\u9700\u6c42\u3001\u6027\u80fd\u654f\u611f\u573a\u666f\u3002<\/p>\n<p>\u4e00\u4e2a\u5b9e\u9645\u7684\u9009\u62e9\u7b56\u7565&#xff1a;\u65b0\u9879\u76ee\u53ef\u4ee5\u4ece sqlc \u8d77\u6b65\u2014\u2014\u6027\u80fd\u6700\u63a5\u8fd1\u88f8 SQL\u3001\u7c7b\u578b\u5b89\u5168\u6700\u597d\u3002\u5f53\u9879\u76ee\u589e\u957f\u5230\u52a8\u6001\u67e5\u8be2\u9700\u6c42\u9891\u7e41\u51fa\u73b0\u65f6&#xff0c;\u628a\u52a8\u6001\u67e5\u8be2\u90e8\u5206\u5f15\u5165 GORM \u6216 Ent&#xff0c;\u9759\u6001\u67e5\u8be2\u4fdd\u6301 sqlc\u3002\u6df7\u5408\u4e0d\u662f\u574f\u4e8b&#xff0c;\u5173\u952e\u662f\u5728\u6bcf\u79cd\u573a\u666f\u4e0b\u7528\u6700\u5408\u9002\u7684\u5de5\u5177\u3002<\/p>\n<p>ORM \u7684\u4ee3\u7801\u4e0d\u662f\u4f60\u5199\u7684\u6700\u540e\u4e00\u884c&#xff0c;\u800c\u662f\u672a\u6765\u4e24\u5e74\u4ee3\u7801\u7ef4\u62a4\u91cc\u4e00\u76f4\u8981\u8bfb\u7684\u90a3\u90e8\u5206\u3002\u9009\u6846\u67b6\u7684\u6807\u51c6\u5e94\u8be5\u662f&#034;\u4e09\u5e74\u540e\u8fd8\u6709\u4eba\u80fd\u770b\u61c2\u5417&#034;&#xff0c;\u800c\u4e0d\u662f&#034;\u4eca\u5929\u80fd\u5c11\u5199\u51e0\u884c\u5417&#034;\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go ORM \u6846\u67b6\u9009\u578b&#xff1a;GORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f<br \/>\n\u4e00\u3001\u4ece\\&#8221;\u80fd\u7528\\&#8221;\u5230\\&#8221;\u4e0d\u51fa\u4e8b\\&#8221;&#xff1a;ORM \u9009\u578b\u88ab\u4f4e\u4f30\u7684\u5de5\u7a0b\u5f71\u54cd<br \/>\nGo \u751f\u6001\u7684 ORM \u9009\u578b\u4e0d\u50cf Java \u90a3\u6837\u6709\u4e00\u4e2a Hibernate \u7ea7\u522b\u7684\\&#8221;\u6807\u51c6\u7b54\u6848\\&#8221;\u3002GORM \u7528\u6237\u57fa\u6570\u6700\u5927&#xff0c;Ent \u6765\u81ea Facebook \u7684\u5b9e\u8df5\u6c89\u6dc0&#xff0c;sqlc \u5219\u4ee3\u8868\u4e86\u53e6\u4e00\u79cd\u6d41\u6d3e\u2014\u2014\u76f4\u63a5\u4ece SQL \u751f\u6210\u7c7b\u578b\u5b89\u5168\u7684 Go \u4ee3\u7801\u3002\u4e09\u8005\u7684\u8bbe\u8ba1\u7406\u5ff5\u5dee\u5f02\u4e0d\u662f\\&#8221;\u8c01\u66f4\u597d\\&#8221;\u7684\u95ee\u9898&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50],"topic":[],"class_list":["post-92582","post","type-post","status-publish","format-standard","hentry","category-server","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/92582.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Go ORM \u6846\u67b6\u9009\u578b&#xff1a;GORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f \u4e00\u3001\u4ece&quot;\u80fd\u7528&quot;\u5230&quot;\u4e0d\u51fa\u4e8b&quot;&#xff1a;ORM \u9009\u578b\u88ab\u4f4e\u4f30\u7684\u5de5\u7a0b\u5f71\u54cd Go \u751f\u6001\u7684 ORM \u9009\u578b\u4e0d\u50cf Java \u90a3\u6837\u6709\u4e00\u4e2a Hibernate \u7ea7\u522b\u7684&quot;\u6807\u51c6\u7b54\u6848&quot;\u3002GORM \u7528\u6237\u57fa\u6570\u6700\u5927&#xff0c;Ent \u6765\u81ea Facebook \u7684\u5b9e\u8df5\u6c89\u6dc0&#xff0c;sqlc \u5219\u4ee3\u8868\u4e86\u53e6\u4e00\u79cd\u6d41\u6d3e\u2014\u2014\u76f4\u63a5\u4ece SQL \u751f\u6210\u7c7b\u578b\u5b89\u5168\u7684 Go \u4ee3\u7801\u3002\u4e09\u8005\u7684\u8bbe\u8ba1\u7406\u5ff5\u5dee\u5f02\u4e0d\u662f&quot;\u8c01\u66f4\u597d&quot;\u7684\u95ee\u9898&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/92582.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-10T09:24:47+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/92582.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/92582.html\",\"name\":\"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-10T09:24:47+00:00\",\"dateModified\":\"2026-08-10T09:24:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/92582.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/92582.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/92582.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/92582.html","og_locale":"zh_CN","og_type":"article","og_title":"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Go ORM \u6846\u67b6\u9009\u578b&#xff1a;GORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f \u4e00\u3001\u4ece\"\u80fd\u7528\"\u5230\"\u4e0d\u51fa\u4e8b\"&#xff1a;ORM \u9009\u578b\u88ab\u4f4e\u4f30\u7684\u5de5\u7a0b\u5f71\u54cd Go \u751f\u6001\u7684 ORM \u9009\u578b\u4e0d\u50cf Java \u90a3\u6837\u6709\u4e00\u4e2a Hibernate \u7ea7\u522b\u7684\"\u6807\u51c6\u7b54\u6848\"\u3002GORM \u7528\u6237\u57fa\u6570\u6700\u5927&#xff0c;Ent \u6765\u81ea Facebook \u7684\u5b9e\u8df5\u6c89\u6dc0&#xff0c;sqlc \u5219\u4ee3\u8868\u4e86\u53e6\u4e00\u79cd\u6d41\u6d3e\u2014\u2014\u76f4\u63a5\u4ece SQL \u751f\u6210\u7c7b\u578b\u5b89\u5168\u7684 Go \u4ee3\u7801\u3002\u4e09\u8005\u7684\u8bbe\u8ba1\u7406\u5ff5\u5dee\u5f02\u4e0d\u662f\"\u8c01\u66f4\u597d\"\u7684\u95ee\u9898&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/92582.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-10T09:24:47+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/92582.html","url":"https:\/\/www.wsisp.com\/helps\/92582.html","name":"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-10T09:24:47+00:00","dateModified":"2026-08-10T09:24:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/92582.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/92582.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/92582.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Go ORM \u6846\u67b6\u9009\u578b\uff1aGORM\u3001Ent \u548c sqlc \u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/92582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=92582"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/92582\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=92582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=92582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=92582"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=92582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}