22 lines
382 B
Go
22 lines
382 B
Go
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),
|
|
}
|
|
}
|