Skip to content

Commit

Permalink
feat: Optimize curd
Browse files Browse the repository at this point in the history
  • Loading branch information
fynntang committed Aug 29, 2023
1 parent c0ae0d5 commit 59aa60a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions protoc-gen-go-crud/repositories/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func New{{.ServiceType}}Repo() I{{.ServiceType}}Repo{
return &{{.ServiceType}}Repo{}
}
func ({{$firstLetter}} *{{.ServiceType}}Repo) log(ctx context.Context) *zap.SugaredLogger {
func (r *{{.ServiceType}}Repo) log(ctx context.Context) *zap.SugaredLogger {
return global.Logger(ctx).Named("{{.ServiceType}}Repo")
}
func ({{$firstLetter}} *{{.ServiceType}}Repo) DB(ctx context.Context) *gorm.DB {
func (r *{{.ServiceType}}Repo) DB(ctx context.Context) *gorm.DB {
return global.DBFromContext(ctx).Model(&entities.{{.ServiceType}}{})
}
Expand Down

0 comments on commit 59aa60a

Please sign in to comment.