Skip to content

Commit

Permalink
generator: enhance migration template
Browse files Browse the repository at this point in the history
  • Loading branch information
agungdwiprasetyo committed Aug 6, 2024
1 parent fa1ad4e commit e8d5848
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/candi/template_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func main() {
if len(args) > 2 {
migrationType = args[2]
}
if err := goose.Create(db, "migrations", args[1], migrationType); err != nil {
if err := goose.Create(db, os.Getenv("WORKDIR") + "cmd/migration/migrations", args[1], migrationType); err != nil {
log.Fatalf("goose %v: %v", args[1], err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/candi/template_delivery_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (h *{{.WorkerPluginName}}Handler) handleTopic{{upper (camel .ModuleName)}}(
func getWorkerFuncTemplate(workerName, moduleName, usecaseName string) string {
moduleName, usecaseName = strings.Title(moduleName), strings.Title(usecaseName)
return `func (h *` + workerName + `Handler) ` + candihelper.ToCamelCase(usecaseName) + `(eventContext *candishared.EventContext) error {
trace, ctx := tracer.StartTraceWithContext(eventContext.Context(), "` + moduleName + `DeliveryRedis:` + usecaseName + `")
trace, ctx := tracer.StartTraceWithContext(eventContext.Context(), "` + moduleName + `Delivery` + workerName + `:` + usecaseName + `")
defer trace.Finish()
var payload domain.Request` + usecaseName + `
Expand Down
2 changes: 1 addition & 1 deletion init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package candi

const (
// Version of this library
Version = "v1.17.15"
Version = "v1.17.16"
)
4 changes: 0 additions & 4 deletions middleware/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ func (m *Middleware) HTTPCache(next http.Handler) http.Handler {
cacheKey := req.Method + ":" + strings.TrimSuffix(req.URL.String(), "/")
trace.SetTag("key", cacheKey)
if cacheVal, err := m.cache.Get(ctx, cacheKey); err == nil {
if ttl, err := m.cache.GetTTL(ctx, cacheKey); err == nil {
res.Header().Add(candihelper.HeaderExpires, time.Now().In(time.UTC).Add(ttl).Format(time.RFC1123))
}

var data cacheData
if err := json.Unmarshal(cacheVal, &data); err != nil {
m.cache.Delete(ctx, cacheKey)
Expand Down

0 comments on commit e8d5848

Please sign in to comment.