Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Sep 3, 2020
1 parent 1e85f74 commit d1129e3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions example/shorturl/api/internal/logic/expandlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (
)

type ExpandLogic struct {
svcCtx *svc.ServiceContext
ctx context.Context
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}

func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) ExpandLogic {
return ExpandLogic{
svcCtx: svcCtx,
ctx: ctx,
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}

Expand Down
8 changes: 4 additions & 4 deletions example/shorturl/api/internal/logic/shortenlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (
)

type ShortenLogic struct {
svcCtx *svc.ServiceContext
ctx context.Context
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}

func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) ShortenLogic {
return ShortenLogic{
svcCtx: svcCtx,
ctx: ctx,
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}

Expand Down
4 changes: 2 additions & 2 deletions example/shorturl/rpc/transform/internal/logic/expandlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (
)

type ExpandLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}

func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ExpandLogic {
return &ExpandLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}

Expand Down
4 changes: 2 additions & 2 deletions example/shorturl/rpc/transform/internal/logic/shortenlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
)

type ShortenLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}

func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShortenLogic {
return &ShortenLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/goctl/api/gogen/genlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import (
)
type {{.logic}} struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) {{.logic}} {
return {{.logic}}{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/goctl/api/parser/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"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*\))`

var (
Expand Down

0 comments on commit d1129e3

Please sign in to comment.