make svcCtx as a member for better code generation
This commit is contained in:
@@ -20,13 +20,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type {{.logic}} struct {
|
type {{.logic}} struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
logx.Logger
|
logx.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) {{.logic}} {
|
func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) {{.logic}} {
|
||||||
return {{.logic}}{
|
return {{.logic}}{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type {{.logicName}} struct {
|
type {{.logicName}} struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
logx.Logger
|
logx.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func New{{.logicName}}(ctx context.Context,svcCtx *svc.ServiceContext) *{{.logicName}} {
|
func New{{.logicName}}(ctx context.Context,svcCtx *svc.ServiceContext) *{{.logicName}} {
|
||||||
return &{{.logicName}}{
|
return &{{.logicName}}{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user