transfer_middleware/cmd/rpc/internal/svc/serviceContext.go

40 lines
930 B
Go
Raw Normal View History

2024-06-07 11:11:04 +08:00
package svc
import (
"github.com/zeromicro/go-zero/core/stores/redis"
"trasfer_middleware/cmd/rpc/internal/config"
"trasfer_middleware/cmd/rpc/internal/logic/po/market"
2024-06-07 11:11:04 +08:00
"trasfer_middleware/cmd/rpc/internal/logic/po/zltx"
)
type ServiceContext struct {
Config config.Config
RedisClient *redis.Redis
ZltxOrder *zltx.ZltxOrder
Market *market.Market
2024-06-07 11:11:04 +08:00
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
RedisClient: redis.MustNewRedis(redis.RedisConf{
Host: c.Redis.Host,
Type: c.Redis.Type,
Pass: c.Redis.Pass,
}),
ZltxOrder: zltx.NewZltxOrder(c.ZLTX),
Market: market.NewMarket(c.Market),
2024-06-07 11:11:04 +08:00
}
}
func DbModel(datasource string, c config.Config) *Model {
//sqlConn := sqlx.NewMysql(datasource)
2024-06-07 11:11:04 +08:00
return &Model{
//ClientModel: genModel.NewServerClientModel(sqlConn, c.Cache),
2024-06-07 11:11:04 +08:00
}
}
type Model struct {
//ClientModel genModel.ServerClientModel
2024-06-07 11:11:04 +08:00
}