Skip to content

Commit

Permalink
update config & usecase generator
Browse files Browse the repository at this point in the history
  • Loading branch information
agungdwiprasetyo committed Jan 17, 2024
1 parent 63d6c7b commit a04e388
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion cmd/candi/template_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ func LoadServiceConfigs(baseCfg *config.Config) (deps dependency.Dependency) {
shared.SetEnv(sharedEnv)
logger.InitZap()
tracer.InitJaeger(baseCfg.ServiceName)
// logger.SetMaskLog(logger.NewMasker()) // add this for mask sensitive information
baseCfg.LoadFunc(func(ctx context.Context) []interfaces.Closer {
jaeger := tracer.InitJaeger(baseCfg.ServiceName)
{{if not .RedisDeps}}// {{end}}redisDeps := database.InitRedis()
{{if not .SQLDeps}}// {{end}}sqlDeps := database.InitSQLDatabase()
{{if not .MongoDeps}}// {{end}}mongoDeps := database.InitMongoDB(ctx)
Expand All @@ -64,6 +65,7 @@ func LoadServiceConfigs(baseCfg *config.Config) (deps dependency.Dependency) {
// ... add more dependencies
)
return []interfaces.Closer{ // throw back to base config for close connection when application shutdown
jaeger,
brokerDeps,
locker,
{{if not .RedisDeps}}// {{end}}redisDeps,
Expand Down
7 changes: 3 additions & 4 deletions cmd/candi/template_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,9 @@ func (uc *{{camel .ModuleName}}UsecaseImpl) GetAll{{upper (camel .ModuleName)}}(
count := uc.repo{{if .SQLDeps}}SQL{{else if .MongoDeps}}Mongo{{else if .ArangoDeps}}Arango{{end}}.{{upper (camel .ModuleName)}}Repo().Count(ctx, filter)
meta = candishared.NewMeta(filter.Page, filter.Limit, count){{end}}
for _, detail := range data {
var res domain.Response{{upper (camel .ModuleName)}}
res.Serialize(&detail)
results = append(results, res)
results = make([]domain.Response{{upper (camel .ModuleName)}}, len(data))
for i, detail := range data {
results[i].Serialize(&detail)
}
return
Expand Down
1 change: 0 additions & 1 deletion codebase/factory/module_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

// ModuleFactory factory
type ModuleFactory interface {
// Basic server type (current using echo rest framework)
RESTHandler() interfaces.RESTHandler
GRPCHandler() interfaces.GRPCHandler
GraphQLHandler() interfaces.GraphQLHandler
Expand Down

0 comments on commit a04e388

Please sign in to comment.