master
kevin 4 years ago
parent 1e85f74fd8
commit d1129e3974

@ -10,16 +10,16 @@ import (
) )
type ExpandLogic struct { type ExpandLogic struct {
svcCtx *svc.ServiceContext
ctx context.Context
logx.Logger logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
} }
func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) ExpandLogic { func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) ExpandLogic {
return ExpandLogic{ return ExpandLogic{
svcCtx: svcCtx,
ctx: ctx,
Logger: logx.WithContext(ctx), Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
} }
} }

@ -10,16 +10,16 @@ import (
) )
type ShortenLogic struct { type ShortenLogic struct {
svcCtx *svc.ServiceContext
ctx context.Context
logx.Logger logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
} }
func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) ShortenLogic { func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) ShortenLogic {
return ShortenLogic{ return ShortenLogic{
svcCtx: svcCtx,
ctx: ctx,
Logger: logx.WithContext(ctx), Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
} }
} }

@ -10,16 +10,16 @@ import (
) )
type ExpandLogic struct { type ExpandLogic struct {
logx.Logger
ctx context.Context ctx context.Context
svcCtx *svc.ServiceContext svcCtx *svc.ServiceContext
logx.Logger
} }
func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ExpandLogic { func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ExpandLogic {
return &ExpandLogic{ return &ExpandLogic{
Logger: logx.WithContext(ctx),
ctx: ctx, ctx: ctx,
svcCtx: svcCtx, svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
} }
} }

@ -12,16 +12,16 @@ import (
) )
type ShortenLogic struct { type ShortenLogic struct {
logx.Logger
ctx context.Context ctx context.Context
svcCtx *svc.ServiceContext svcCtx *svc.ServiceContext
logx.Logger
} }
func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShortenLogic { func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShortenLogic {
return &ShortenLogic{ return &ShortenLogic{
Logger: logx.WithContext(ctx),
ctx: ctx, ctx: ctx,
svcCtx: svcCtx, svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
} }
} }

@ -20,16 +20,16 @@ import (
) )
type {{.logic}} struct { type {{.logic}} struct {
logx.Logger
ctx context.Context ctx context.Context
svcCtx *svc.ServiceContext svcCtx *svc.ServiceContext
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}}{
Logger: logx.WithContext(ctx),
ctx: ctx, ctx: ctx,
svcCtx: svcCtx, svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
} }
} }

@ -9,7 +9,7 @@ import (
"github.com/tal-tech/go-zero/tools/goctl/api/spec" "github.com/tal-tech/go-zero/tools/goctl/api/spec"
) )
// struct匹配 // struct match
const typeRegex = `(?m)(?m)(^ *type\s+[a-zA-Z][a-zA-Z0-9_-]+\s+(((struct)\s*?\{[\w\W]*?[^\{]\})|([a-zA-Z][a-zA-Z0-9_-]+)))|(^ *type\s*?\([\w\W]+\}\s*\))` const typeRegex = `(?m)(?m)(^ *type\s+[a-zA-Z][a-zA-Z0-9_-]+\s+(((struct)\s*?\{[\w\W]*?[^\{]\})|([a-zA-Z][a-zA-Z0-9_-]+)))|(^ *type\s*?\([\w\W]+\}\s*\))`
var ( var (

Loading…
Cancel
Save