You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
409 B
Go
21 lines
409 B
Go
4 years ago
|
package svc
|
||
|
|
||
|
import (
|
||
|
"shorturl/rpc/transform/internal/config"
|
||
|
"shorturl/rpc/transform/model"
|
||
|
|
||
|
"github.com/tal-tech/go-zero/core/stores/sqlx"
|
||
|
)
|
||
|
|
||
|
type ServiceContext struct {
|
||
|
c config.Config
|
||
|
Model *model.ShorturlModel
|
||
|
}
|
||
|
|
||
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||
|
return &ServiceContext{
|
||
|
c: c,
|
||
|
Model: model.NewShorturlModel(sqlx.NewMysql(c.DataSource), c.Cache, c.Table),
|
||
|
}
|
||
|
}
|