initial commit
This commit is contained in:
21
gallery/internal/svc/servicecontext.go
Normal file
21
gallery/internal/svc/servicecontext.go
Normal file
@ -0,0 +1,21 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"godemo/file/file"
|
||||
"godemo/gallery/internal/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
FileRpc file.FileClient
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
conn := zrpc.MustNewClient(c.FileRpc).Conn()
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
FileRpc: file.NewFileClient(conn),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user