Support custom types

This commit is contained in:
2025-01-08 16:48:34 -05:00
parent 70ba85bf79
commit 56037c4b05
2 changed files with 114 additions and 0 deletions

View File

@ -23,3 +23,10 @@ func MustSetupConfigAndLogging(ctx context.Context) context.Context {
zerolog.Ctx(ctx).Trace().Any("config", *cfg).Send()
return ctx
}
// Unmarshal config into a custom type
// Type MUST include *config.AppConfig
// Stored in context as *config.AppConfig but can be asserted back
func MustSetupConfigAndLoggingInto[T any](ctx context.Context, into T) (context.Context, T) {
return ctx, into
}