mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
wrap payload for all processors
This commit is contained in:
26
internal/common/payload.go
Normal file
26
internal/common/payload.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type WrappedPayload struct {
|
||||
Payload any
|
||||
Modules any
|
||||
Sender any
|
||||
End bool
|
||||
}
|
||||
|
||||
func GetWrappedPayload(ctx context.Context, payload any) WrappedPayload {
|
||||
templateData := WrappedPayload{Payload: payload}
|
||||
modules := ctx.Value(ModulesContextKey)
|
||||
if modules != nil {
|
||||
templateData.Modules = modules
|
||||
}
|
||||
|
||||
sender := ctx.Value(SenderContextKey)
|
||||
if sender != nil {
|
||||
templateData.Sender = sender
|
||||
}
|
||||
return templateData
|
||||
}
|
||||
Reference in New Issue
Block a user