{"id":209713,"date":"2020-11-28T08:48:19","date_gmt":"2020-11-28T00:48:19","guid":{"rendered":"http:\/\/4563.org\/?p=209713"},"modified":"2020-11-28T08:48:19","modified_gmt":"2020-11-28T00:48:19","slug":"go-struct-%e9%87%8c%e7%94%a8%e4%bb%80%e4%b9%88%e7%b1%bb%e5%9e%8b%e6%9d%a5%e5%a4%84%e7%90%86-mysql-%e7%9a%84-decimal-%e7%b1%bb%e5%9e%8b%e7%9a%84%e5%80%bc","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=209713","title":{"rendered":"go struct \u91cc\u7528\u4ec0\u4e48\u7c7b\u578b\u6765\u5904\u7406 mysql \u7684 decimal \u7c7b\u578b\u7684\u503c"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  go struct \u91cc\u7528\u4ec0\u4e48\u7c7b\u578b\u6765\u5904\u7406 mysql \u7684 decimal \u7c7b\u578b\u7684\u503c               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lalawac <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u62a5\u9519 Scan error on column index 4, name &#8220;money&#8221;: converting driver.Value type []uint8 (&#8220;0.100&#8221;) to a int: invalid syntax<\/p>\n<pre><code>type Order struct{  Id    int     `\"db:\"id\"`  Money float32 `\"db:money\"` }   var order Order  rows, err = DB.Query(\"select money from order where id =1\") rows.Scan(&amp;order.Money) <\/code><\/pre>\n<p>google \u4e86\u534a\u5929\uff0c\u5c1d\u8bd5\u4e86\u51e0\u79cd decimal \u7c7b\u578b\u4ecd\u7136\u4e0d\u884c,<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4358147\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rimutuyuan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u6216\u8bb8\u6709\u7528<br \/>https:\/\/github.com\/shopspring\/decimal                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4358148\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : lalawac <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @rimutuyuan \u8c22\u8c22, \u641e\u5b9a\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>go struct \u91cc\u7528\u4ec0\u4e48\u7c7b\u578b\u6765&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/209713"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209713"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/209713\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209713"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}