{"id":41576,"date":"2025-06-03T23:27:17","date_gmt":"2025-06-03T15:27:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/41576.html"},"modified":"2025-06-03T23:27:17","modified_gmt":"2025-06-03T15:27:17","slug":"gorabbitmqgingormdocker-%e9%83%a8%e7%bd%b2-demo","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/41576.html","title":{"rendered":"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo"},"content":{"rendered":"<p>\u66f4\u591a\u4e2a\u4eba\u7b14\u8bb0\u89c1&#xff1a; &#xff08;\u6ce8\u610f\u70b9\u51fb\u201c\u7ee7\u7eed\u201d&#xff0c;\u800c\u4e0d\u662f\u201c\u53d1\u73b0\u65b0\u9879\u76ee\u201d&#xff09; github\u4e2a\u4eba\u7b14\u8bb0\u4ed3\u5e93 https:\/\/github.com\/ZHLOVEYY\/IT_note gitee \u4e2a\u4eba\u7b14\u8bb0\u4ed3\u5e93 https:\/\/gitee.com\/harryhack\/it_note \u4e2a\u4eba\u5b66\u4e60&#xff0c;\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u8fd8\u4f1a\u4e0d\u65ad\u8865\u5145&#xff5e; &#xff08;\u540e\u7eed\u4f1a\u66f4\u65b0\u5728github\u4e0a&#xff09;<\/p>\n<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\n<ul>\n<li>\u76ee\u5f55<\/li>\n<li>\u51c6\u5907<\/li>\n<li>\u8fd0\u884c<\/li>\n<li>\u6d4b\u8bd5<\/li>\n<li>\n<ul>\n<li>\n<ul>\n<li>postman<\/li>\n<li>\u68c0\u67e5\u5bb9\u5668<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\u94fe\u63a5&#xff1a;\u9879\u76ee\u8fde\u63a5,\u5b8c\u6574\u9879\u76ee\u4ee3\u7801\u4ed3\u5e93\u4e0b\u8f7d<\/li>\n<li>https:\/\/gitee.com\/harryhack\/it_note\/tree\/main\/%E5%90%8E%E7%AB%AF%E7%AC%94%E8%AE%B0\/%E5%B8%B8%E7%94%A8Web%E6%8A%80%E6%9C%AF\/RabbitMQ<\/li>\n<\/ul>\n<h3>\u76ee\u5f55<\/h3>\n<p>demo \u76ee\u5f55<\/p>\n<p>post-platform\/<br \/>\n\u251c\u2500\u2500 Dockerfile        # Go \u5e94\u7528 Dockerfile<br \/>\n\u251c\u2500\u2500 docker-compose.yml # Docker Compose \u914d\u7f6e<br \/>\n\u251c\u2500\u2500 main.go           # \u4e3b\u7a0b\u5e8f&#xff08;Gin &#043; RabbitMQ \u6d88\u8d39\u8005&#xff09;<br \/>\n\u251c\u2500\u2500 db\/<br \/>\n\u2502   \u2514\u2500\u2500 db.go         # \u6570\u636e\u5e93\u8fde\u63a5<br \/>\n\u251c\u2500\u2500 models\/<br \/>\n\u2502   \u2514\u2500\u2500 post.go       # \u5e16\u5b50\u6a21\u578b<br \/>\n\u251c\u2500\u2500 rabbitmq\/<br \/>\n\u2502   \u2514\u2500\u2500 consumer.go   # RabbitMQ \u6d88\u8d39\u8005\u903b\u8f91<br \/>\n\u251c\u2500\u2500 go.mod<br \/>\n\u2514\u2500\u2500 go.sum<\/p>\n<h3>\u51c6\u5907<\/h3>\n<ul>\n<li>docker<\/li>\n<li>docker-compose<\/li>\n<\/ul>\n<h3>\u8fd0\u884c<\/h3>\n<p>docker-compose up &#8211;build \u7136\u540e\u5728 docker \u4e2d\u53ef\u4ee5\u68c0\u67e5\u5bb9\u5668\u60c5\u51b5<\/p>\n<h3>\u6d4b\u8bd5<\/h3>\n<h5>postman<\/h5>\n<ul>\n<li>http:\/\/localhost:8080\/ping GET<\/li>\n<li>http:\/\/localhost:8080\/posts POST<\/li>\n<\/ul>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;title&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;My First post&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string-property property\">&#034;content&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Hello, world!&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>\u68c0\u67e5\u5bb9\u5668<\/h5>\n<ul>\n<li>docker exec -it fortest-mysql-1 mysql -u root -p\n<ul>\n<li>\u7136\u540e\u8f93\u5165\u5bc6\u7801&#xff0c;\u68c0\u67e5\u6570\u636e\u5e93 use posts_db , select * from posts<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb553\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5feb\u901f\u4e0a\u624b\u90e8\u7f72demo\uff0cGO+RabbitMQ+Gin+Gorm+docker<\/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":[27,3818,746,663,292,371,305],"topic":[],"class_list":["post-41576","post","type-post","status-publish","format-standard","hentry","category-server","tag-docker","tag-gin","tag-golang","tag-rabbitmq","tag-292","tag-371","tag-305"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \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\/41576.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb553\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5feb\u901f\u4e0a\u624b\u90e8\u7f72demo\uff0cGO+RabbitMQ+Gin+Gorm+docker\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/41576.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-03T15:27:17+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\/41576.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/41576.html\",\"name\":\"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-03T15:27:17+00:00\",\"dateModified\":\"2025-06-03T15:27:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/41576.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/41576.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41576.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo\"}]},{\"@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+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \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\/41576.html","og_locale":"zh_CN","og_type":"article","og_title":"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb553\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5feb\u901f\u4e0a\u624b\u90e8\u7f72demo\uff0cGO+RabbitMQ+Gin+Gorm+docker","og_url":"https:\/\/www.wsisp.com\/helps\/41576.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-03T15:27:17+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\/41576.html","url":"https:\/\/www.wsisp.com\/helps\/41576.html","name":"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-03T15:27:17+00:00","dateModified":"2025-06-03T15:27:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/41576.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/41576.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/41576.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"GO+RabbitMQ+Gin+Gorm+docker \u90e8\u7f72 demo"}]},{"@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\/41576","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=41576"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41576\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=41576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=41576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=41576"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=41576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}