使用 xsdgen 解组 XML
来源:stackoverflow
2024-04-07 15:09:35
0浏览
收藏
本篇文章主要是结合我之前面试的各种经历和实战开发中遇到的问题解决经验整理的,希望这篇《使用 xsdgen 解组 XML》对你有很大帮助!欢迎收藏,分享给更多的需要的朋友学习~
问题内容
我正在尝试使用 golang 解析 xml 文件。
我使用 xsdgen 生成结构部分
我无法使用 xml.unmarshal(bytevalue, &data)
解析文件
我期望程序打印:grandtotalamount.value 这是 671.15,但它打印的是 0。
变量 data
似乎为空,因为这一行没有按我的预期工作:
xml.unmarshal(bytevalue, &data)
我没有看到任何编译错误(或者我不知道在哪里可以找到它们)
我觉得我错过了一些东西,你能帮我吗?
xsd 文件:https://gist.github.com/hyperi0n/a5eb805d9f91de84d341ea75cfe6d1bf
xml 文件:
<?xml version='1.0' encoding='utf-8'?> <rsm:crossindustryinvoice xmlns:qdt="urn:un:unece:uncefact:data:standard:qualifieddatatype:100" xmlns:ram="urn:un:unece:uncefact:data:standard:reusableaggregatebusinessinformationentity:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:crossindustryinvoice:100" xmlns:udt="urn:un:unece:uncefact:data:standard:unqualifieddatatype:100" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <rsm:exchangeddocumentcontext> <ram:guidelinespecifieddocumentcontextparameter> <ram:id>urn:factur-x.eu:1p0:minimum</ram:id> </ram:guidelinespecifieddocumentcontextparameter> </rsm:exchangeddocumentcontext> <rsm:exchangeddocument> <ram:id>fa-2017-0010</ram:id> <ram:typecode>380</ram:typecode> <ram:issuedatetime> <udt:datetimestring format="102">20171113</udt:datetimestring> </ram:issuedatetime> </rsm:exchangeddocument> <rsm:supplychaintradetransaction> <ram:applicableheadertradeagreement> <ram:sellertradeparty> <ram:name>au bon moulin</ram:name> <ram:specifiedlegalorganization> <ram:id schemeid="0002">99999999800010</ram:id> </ram:specifiedlegalorganization> <ram:postaltradeaddress> <ram:countryid>fr</ram:countryid> </ram:postaltradeaddress> <ram:specifiedtaxregistration> <ram:id schemeid="va">fr11999999998</ram:id> </ram:specifiedtaxregistration> </ram:sellertradeparty> <ram:buyertradeparty> <ram:name>ma jolie boutique</ram:name> <ram:specifiedlegalorganization> <ram:id schemeid="0002">78787878400035</ram:id> </ram:specifiedlegalorganization> <ram:postaltradeaddress> <ram:countryid>fr</ram:countryid> </ram:postaltradeaddress> <ram:specifiedtaxregistration> <ram:id schemeid="va">fr19787878784</ram:id> </ram:specifiedtaxregistration> </ram:buyertradeparty> <ram:buyerorderreferenceddocument> <ram:issuerassignedid>po445</ram:issuerassignedid> </ram:buyerorderreferenceddocument> </ram:applicableheadertradeagreement> <ram:applicableheadertradedelivery/> <ram:applicableheadertradesettlement> <ram:invoicecurrencycode>eur</ram:invoicecurrencycode> <ram:specifiedtradesettlementheadermonetarysummation> <ram:taxbasistotalamount>624.90</ram:taxbasistotalamount> <ram:taxtotalamount currencyid="eur">46.25</ram:taxtotalamount> <ram:grandtotalamount>671.15</ram:grandtotalamount> <ram:duepayableamount>470.15</ram:duepayableamount> </ram:specifiedtradesettlementheadermonetarysummation> </ram:applicableheadertradesettlement> </rsm:supplychaintradetransaction> </rsm:crossindustryinvoice>
转到文件:
package main import ( "encoding/xml" "fmt" "io/ioutil" "os" ) type AmountType struct { Value float64 `xml:",chardata"` CurrencyID string `xml:"currencyID,attr,omitempty"` } // May be one of 1A, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW type CountryIDContentType string type CrossIndustryInvoiceType struct { ExchangedDocumentContext ExchangedDocumentContextType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 ExchangedDocumentContext"` ExchangedDocument ExchangedDocumentType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 ExchangedDocument"` SupplyChainTradeTransaction SupplyChainTradeTransactionType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 SupplyChainTradeTransaction"` } // May be one of AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL type CurrencyCodeContentType string type DateTimeString struct { Value string `xml:",chardata"` Format string `xml:"format,attr"` } type DateTimeType struct { DateTimeString DateTimeString `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 DateTimeString"` } // May be one of 80, 81, 82, 83, 84, 130, 202, 203, 204, 211, 261, 262, 295, 296, 308, 325, 326, 380, 381, 383, 384, 385, 386, 387, 388, 389, 390, 393, 394, 395, 396, 420, 456, 457, 458, 527, 575, 623, 633, 751, 780, 935 type DocumentCodeContentType string type DocumentContextParameterType struct { ID IDType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 ID,omitempty"` } type ExchangedDocumentContextType struct { BusinessProcessSpecifiedDocumentContextParameter DocumentContextParameterType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 BusinessProcessSpecifiedDocumentContextParameter,omitempty"` GuidelineSpecifiedDocumentContextParameter DocumentContextParameterType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 GuidelineSpecifiedDocumentContextParameter"` } type ExchangedDocumentType struct { ID IDType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 ID"` TypeCode DocumentCodeContentType `xml:"urn:un:unece:uncefact:data:standard:QualifiedDataType:100 TypeCode"` IssueDateTime DateTimeType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 IssueDateTime"` } type HeaderTradeAgreementType struct { BuyerReference string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 BuyerReference,omitempty"` SellerTradeParty TradePartyType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 SellerTradeParty"` BuyerTradeParty TradePartyType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 BuyerTradeParty"` BuyerOrderReferencedDocument ReferencedDocumentType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 BuyerOrderReferencedDocument,omitempty"` } type HeaderTradeDeliveryType struct { } type HeaderTradeSettlementType struct { InvoiceCurrencyCode CurrencyCodeContentType `xml:"urn:un:unece:uncefact:data:standard:QualifiedDataType:100 InvoiceCurrencyCode"` SpecifiedTradeSettlementHeaderMonetarySummation TradeSettlementHeaderMonetarySummationType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 SpecifiedTradeSettlementHeaderMonetarySummation"` } type IDType struct { Value string `xml:",chardata"` SchemeID string `xml:"schemeID,attr,omitempty"` } type LegalOrganizationType struct { ID IDType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 ID,omitempty"` } type ReferencedDocumentType struct { IssuerAssignedID IDType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 IssuerAssignedID"` } type SupplyChainTradeTransactionType struct { ApplicableHeaderTradeAgreement HeaderTradeAgreementType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 ApplicableHeaderTradeAgreement"` ApplicableHeaderTradeDelivery HeaderTradeDeliveryType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 ApplicableHeaderTradeDelivery"` ApplicableHeaderTradeSettlement HeaderTradeSettlementType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 ApplicableHeaderTradeSettlement"` } type TaxRegistrationType struct { ID IDType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 ID"` } type TradeAddressType struct { PostcodeCode string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 PostcodeCode,omitempty"` LineOne string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 LineOne,omitempty"` LineTwo string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 LineTwo,omitempty"` LineThree string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 LineThree,omitempty"` CityName string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 CityName,omitempty"` CountryID CountryIDContentType `xml:"urn:un:unece:uncefact:data:standard:QualifiedDataType:100 CountryID"` CountrySubDivisionName string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 CountrySubDivisionName,omitempty"` } type TradePartyType struct { Name string `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 Name"` SpecifiedLegalOrganization LegalOrganizationType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 SpecifiedLegalOrganization,omitempty"` PostalTradeAddress TradeAddressType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 PostalTradeAddress,omitempty"` SpecifiedTaxRegistration []TaxRegistrationType `xml:"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100 SpecifiedTaxRegistration,omitempty"` } type TradeSettlementHeaderMonetarySummationType struct { TaxBasisTotalAmount AmountType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 TaxBasisTotalAmount"` TaxTotalAmount AmountType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 TaxTotalAmount,omitempty"` GrandTotalAmount AmountType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 GrandTotalAmount"` DuePayableAmount AmountType `xml:"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100 DuePayableAmount"` } func main() { xmlFile, err := os.Open("invoice.xml") if err != nil { fmt.Println(err) } defer xmlFile.Close() byteValue, _ := ioutil.ReadAll(xmlFile) fmt.Println(string(byteValue)) var data CrossIndustryInvoiceType xml.Unmarshal(byteValue, &data) fmt.Println(data.SupplyChainTradeTransaction.ApplicableHeaderTradeSettlement.SpecifiedTradeSettlementHeaderMonetarySummation.GrandTotalAmount.Value) }
解决方案
我认为这与 Go Issue #13400 有关。命名空间前缀似乎存在问题。事实上,您可以在解组时忽略结构标记中的前缀。
以下代码应该适合您:
package main import ( "encoding/xml" "fmt" "io/ioutil" "log" "os" ) type amounttype struct { value float64 `xml:",chardata"` currencyid string `xml:"currencyid,attr,omitempty"` } // may be one of 1a, ad, ae, af, ag, ai, al, am, ao, aq, ar, as, at, au, aw, ax, az, ba, bb, bd, be, bf, bg, bh, bi, bj, bl, bm, bn, bo, bq, br, bs, bt, bv, bw, by, bz, ca, cc, cd, cf, cg, ch, ci, ck, cl, cm, cn, co, cr, cu, cv, cw, cx, cy, cz, de, dj, dk, dm, do, dz, ec, ee, eg, eh, er, es, et, fi, fj, fk, fm, fo, fr, ga, gb, gd, ge, gf, gg, gh, gi, gl, gm, gn, gp, gq, gr, gs, gt, gu, gw, gy, hk, hm, hn, hr, ht, hu, id, ie, il, im, in, io, iq, ir, is, it, je, jm, jo, jp, ke, kg, kh, ki, km, kn, kp, kr, kw, ky, kz, la, lb, lc, li, lk, lr, ls, lt, lu, lv, ly, ma, mc, md, me, mf, mg, mh, mk, ml, mm, mn, mo, mp, mq, mr, ms, mt, mu, mv, mw, mx, my, mz, na, nc, ne, nf, ng, ni, nl, no, np, nr, nu, nz, om, pa, pe, pf, pg, ph, pk, pl, pm, pn, pr, ps, pt, pw, py, qa, re, ro, rs, ru, rw, sa, sb, sc, sd, se, sg, sh, si, sj, sk, sl, sm, sn, so, sr, ss, st, sv, sx, sy, sz, tc, td, tf, tg, th, tj, tk, tl, tm, tn, to, tr, tt, tv, tw, tz, ua, ug, um, us, uy, uz, va, vc, ve, vg, vi, vn, vu, wf, ws, ye, yt, za, zm, zw type countryidcontenttype string type crossindustryinvoicetype struct { exchangeddocumentcontext exchangeddocumentcontexttype `xml:"exchangeddocumentcontext"` exchangeddocument exchangeddocumenttype `xml:"exchangeddocument"` supplychaintradetransaction supplychaintradetransactiontype `xml:"supplychaintradetransaction"` } // may be one of aed, afn, all, amd, ang, aoa, ars, aud, awg, azn, bam, bbd, bdt, bgn, bhd, bif, bmd, bnd, bob, bov, brl, bsd, btn, bwp, byn, bzd, cad, cdf, che, chf, chw, clf, clp, cny, cop, cou, crc, cuc, cup, cve, czk, djf, dkk, dop, dzd, egp, ern, etb, eur, fjd, fkp, gbp, gel, ghs, gip, gmd, gnf, gtq, gyd, hkd, hnl, hrk, htg, huf, idr, ils, inr, iqd, irr, isk, jmd, jod, jpy, kes, kgs, khr, kmf, kpw, krw, kwd, kyd, kzt, lak, lbp, lkr, lrd, lsl, lyd, mad, mdl, mga, mkd, mmk, mnt, mop, mru, mur, mvr, mwk, mxn, mxv, myr, mzn, nad, ngn, nio, nok, npr, nzd, omr, pab, pen, pgk, php, pkr, pln, pyg, qar, ron, rsd, rub, rwf, sar, sbd, scr, sdg, sek, sgd, shp, sll, sos, srd, ssp, stn, svc, syp, szl, thb, tjs, tmt, tnd, top, try, ttd, twd, tzs, uah, ugx, usd, usn, uyi, uyu, uyw, uzs, ves, vnd, vuv, wst, xaf, xag, xau, xba, xbb, xbc, xbd, xcd, xdr, xof, xpd, xpf, xpt, xsu, xts, xua, xxx, yer, zar, zmw, zwl type currencycodecontenttype string type datetimestring struct { value string `xml:",chardata"` format string `xml:"format,attr"` } type datetimetype struct { datetimestring datetimestring `xml:"datetimestring"` } // may be one of 80, 81, 82, 83, 84, 130, 202, 203, 204, 211, 261, 262, 295, 296, 308, 325, 326, 380, 381, 383, 384, 385, 386, 387, 388, 389, 390, 393, 394, 395, 396, 420, 456, 457, 458, 527, 575, 623, 633, 751, 780, 935 type documentcodecontenttype string type documentcontextparametertype struct { id idtype `xml:"id,omitempty"` } type exchangeddocumentcontexttype struct { businessprocessspecifieddocumentcontextparameter documentcontextparametertype `xml:"businessprocessspecifieddocumentcontextparameter,omitempty"` guidelinespecifieddocumentcontextparameter documentcontextparametertype `xml:"guidelinespecifieddocumentcontextparameter"` } type exchangeddocumenttype struct { id idtype `xml:"id"` typecode documentcodecontenttype `xml:"typecode"` issuedatetime datetimetype `xml:"issuedatetime"` } type headertradeagreementtype struct { buyerreference string `xml:"buyerreference,omitempty"` sellertradeparty tradepartytype `xml:"sellertradeparty"` buyertradeparty tradepartytype `xml:"buyertradeparty"` buyerorderreferenceddocument referenceddocumenttype `xml:"buyerorderreferenceddocument,omitempty"` } type headertradedeliverytype struct { } type headertradesettlementtype struct { invoicecurrencycode currencycodecontenttype `xml:"invoicecurrencycode"` specifiedtradesettlementheadermonetarysummation tradesettlementheadermonetarysummationtype `xml:"specifiedtradesettlementheadermonetarysummation"` } type idtype struct { value string `xml:",chardata"` schemeid string `xml:"schemeid,attr,omitempty"` } type legalorganizationtype struct { id idtype `xml:"id,omitempty"` } type referenceddocumenttype struct { issuerassignedid idtype `xml:"issuerassignedid"` } type supplychaintradetransactiontype struct { applicableheadertradeagreement headertradeagreementtype `xml:"applicableheadertradeagreement"` applicableheadertradedelivery headertradedeliverytype `xml:"applicableheadertradedelivery"` applicableheadertradesettlement headertradesettlementtype `xml:"applicableheadertradesettlement"` } type taxregistrationtype struct { id idtype `xml:"id"` } type tradeaddresstype struct { postcodecode string `xml:"postcodecode,omitempty"` lineone string `xml:"lineone,omitempty"` linetwo string `xml:"linetwo,omitempty"` linethree string `xml:"linethree,omitempty"` cityname string `xml:"cityname,omitempty"` countryid countryidcontenttype `xml:"countryid"` countrysubdivisionname string `xml:"countrysubdivisionname,omitempty"` } type tradepartytype struct { name string `xml:"name"` specifiedlegalorganization legalorganizationtype `xml:"specifiedlegalorganization,omitempty"` postaltradeaddress tradeaddresstype `xml:"postaltradeaddress,omitempty"` specifiedtaxregistration []taxregistrationtype `xml:"specifiedtaxregistration,omitempty"` } type tradesettlementheadermonetarysummationtype struct { taxbasistotalamount amounttype `xml:"taxbasistotalamount"` taxtotalamount amounttype `xml:"taxtotalamount,omitempty"` grandtotalamount amounttype `xml:"grandtotalamount"` duepayableamount amounttype `xml:"duepayableamount"` } func main() { xmlfile, err := os.open("invoice.xml") if err != nil { log.fatalln(err) } byted, err := ioutil.readall(xmlfile) if err != nil { log.fatalln(err) } xmlfile.close() var data crossindustryinvoicetype if err := xml.unmarshal(byted, &data); err != nil { log.fatalln(err) } fmt.printf("%v\n", data.supplychaintradetransaction.applicableheadertradesettlement.specifiedtradesettlementheadermonetarysummation.grandtotalamount.value) }
输出:
671.15
当我使用xsdgen生成iso20022的相关go代码时,我遇到了同样的问题。应该是xsdgen包里面的一些事情。我已阅读有关 xsdgen 配置的所有选项,但没有选项可以忽略使用 xmltag 添加命名空间。
您可能会专注于 xsdgen 包的实现,或者只是在生成的代码的基础上手动省略额外的命名空间。
本篇关于《使用 xsdgen 解组 XML》的介绍就到此结束啦,但是学无止境,想要了解学习更多关于Golang的相关知识,请关注golang学习网公众号!
版本声明
本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除

- 上一篇
- 模拟外部库进行单元测试

- 下一篇
- 理解 Go 语言中空白标识符的奥妙
查看更多
最新文章
-
- Golang · Go问答 | 1年前 |
- 在读取缓冲通道中的内容之前退出
- 139浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 戈兰岛的全球 GOPRIVATE 设置
- 204浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将结构作为参数传递给 xml-rpc
- 325浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何用golang获得小数点以下两位长度?
- 477浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何通过 client-go 和 golang 检索 Kubernetes 指标
- 486浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将多个“参数”映射到单个可变参数的习惯用法
- 439浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将 HTTP 响应正文写入文件后出现 EOF 错误
- 357浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 结构中映射的匿名列表的“复合文字中缺少类型”
- 352浏览 收藏
-
- Golang · Go问答 | 1年前 |
- NATS Jetstream 的性能
- 101浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将复杂的字符串输入转换为mapstring?
- 440浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 相当于GoLang中Java将Object作为方法参数传递
- 212浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何确保所有 goroutine 在没有 time.Sleep 的情况下终止?
- 143浏览 收藏
查看更多
课程推荐
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 508次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 484次学习
查看更多
AI推荐
-
- 茅茅虫AIGC检测
- 茅茅虫AIGC检测,湖南茅茅虫科技有限公司倾力打造,运用NLP技术精准识别AI生成文本,提供论文、专著等学术文本的AIGC检测服务。支持多种格式,生成可视化报告,保障您的学术诚信和内容质量。
- 95次使用
-
- 赛林匹克平台(Challympics)
- 探索赛林匹克平台Challympics,一个聚焦人工智能、算力算法、量子计算等前沿技术的赛事聚合平台。连接产学研用,助力科技创新与产业升级。
- 100次使用
-
- 笔格AIPPT
- SEO 笔格AIPPT是135编辑器推出的AI智能PPT制作平台,依托DeepSeek大模型,实现智能大纲生成、一键PPT生成、AI文字优化、图像生成等功能。免费试用,提升PPT制作效率,适用于商务演示、教育培训等多种场景。
- 105次使用
-
- 稿定PPT
- 告别PPT制作难题!稿定PPT提供海量模板、AI智能生成、在线协作,助您轻松制作专业演示文稿。职场办公、教育学习、企业服务全覆盖,降本增效,释放创意!
- 100次使用
-
- Suno苏诺中文版
- 探索Suno苏诺中文版,一款颠覆传统音乐创作的AI平台。无需专业技能,轻松创作个性化音乐。智能词曲生成、风格迁移、海量音效,释放您的音乐灵感!
- 98次使用
查看更多
相关文章
-
- GoLand调式动态执行代码
- 2023-01-13 502浏览
-
- 用Nginx反向代理部署go写的网站。
- 2023-01-17 502浏览
-
- Golang取得代码运行时间的问题
- 2023-02-24 501浏览
-
- 请问 go 代码如何实现在代码改动后不需要Ctrl+c,然后重新 go run *.go 文件?
- 2023-01-08 501浏览
-
- 如何从同一个 io.Reader 读取多次
- 2023-04-11 501浏览