我是围棋中微服务的新学习者。我尝试编写自己的微服务。功能很简单。localhost:81/balance/{phone_number}应该返回用户余额的请求是数据库。每当我发送此请求时,我都会看到错误:
net/http.(*conn).serve.func1(0xc00021a000)
/usr/local/go/src/net/http/server.go:1767 +0x139
panic(0x8fe8e0, 0xccafc0)
/usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/jinzhu/gorm.(*DB).clone(0x0, 0x30)
/home/bita/go/src/github.com/jinzhu/gorm/main.go:848 +0x26
github.com/jinzhu/gorm.(*DB).Where(0x0, 0x8d6720, 0xa04b40, 0xc0001fe060, 0x1, 0x1, 0xc00019e5d0)
/home/bita/go/src/github.com/jinzhu/gorm/main.go:235 +0x2f
arvan/wallet/Reository.(*repository).GetBalance(0xc000184c40, 0xa180c0, 0xc0001fa2d0, 0xc00022000d, 0x7, 0xa0f020, 0xc0001fa300, 0x0)
/home/bita/go/src/arvan/wallet/Reository/repo.go:35 +0xeb
arvan/wallet/pkg/service.service.GetBalance(0xa12f80, 0xc000184c40, 0xa0f020, 0xc00019e5d0, 0xa180c0, 0xc0001fa2d0, 0xc00022000d, 0x7, 0xc0001fa270, 0xc0001d0730, ...)
/home/bita/go/src/arvan/wallet/pkg/service/service.go:31 +0x116
arvan/wallet/pkg/http.makeGetBalanceEndpoint.func1(0xa180c0, 0xc0001fa2d0, 0x90d160, 0xc0001fe040, 0xc0001fe040, 0x0, 0x0, 0x0)
/home/bita/go/src/arvan/wallet/pkg/http/endpoint.go:25 +0x72
github.com/go-kit/kit/transport/http.Server.ServeHTTP(0xc000184c80, 0x994260, 0x994270, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9946a8, ...)
/home/bita/go/src/github.com/go-kit/kit/transport/http/server.go:121 +0x1b2
arvan/wallet/pkg/http.commonMiddleware.func1(0xa17240, 0xc00022e000, 0xc000212300)
/home/bita/go/src/arvan/wallet/pkg/http/server.go:33 +0x100
net/http.HandlerFunc.ServeHTTP(0xc000200020, 0xa17240, 0xc00022e000, 0xc000212300)
/usr/local/go/src/net/http/server.go:2007 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000d8540, 0xa17240, 0xc00022e000, 0xc000212100)
我不知道为什么会这样。因为当我尝试使用单体架构时,它一切正常。整个代码的链接在这里
它与上下文有关吗????现在不知道!附言。我所有的代码都受到gokit-tutorial和他在 youtube 上的教程视频的启发。
慕森卡
相关分类