Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFunction ¶
func CreateFunction(eventHandler HandlerType, options ...PayloadOption)
This function creates a Memphis function and processes events with the passed-in eventHandler function. eventHandler gets the message payload as []byte or as the user specified type, message headers as map[string]string and inputs as map[string]string and should return the modified payload and headers. The modified payload type will either be the user type, or []byte depending on user requirements. error should be returned if the message should be considered failed and go into the dead-letter station. if all returned values are nil the message will be filtered out from the station.
func UnmarshalIntoStruct ¶ added in v1.5.0
Types ¶
type HandlerType ¶ added in v1.5.0
HandlerType functions get the message payload as []byte (or any), message headers as map[string]string and inputs as map[string]string and should return the modified payload and headers. error should be returned if the message should be considered failed and go into the dead-letter station. if all returned values are nil the message will be filtered out of the station.
type MemphisEvent ¶
type MemphisEvent struct { Inputs map[string]string `json:"inputs"` Messages []MemphisMsg `json:"messages"` }
type MemphisMsg ¶
type MemphisMsgWithError ¶
type MemphisOutput ¶
type MemphisOutput struct { Messages []MemphisMsg `json:"messages"` FailedMessages []MemphisMsgWithError `json:"failed_messages"` }
type PayloadOption ¶ added in v1.5.0
type PayloadOption func(*PayloadOptions) error
func PayloadAsJSON ¶ added in v1.5.0
func PayloadAsJSON(schema any) PayloadOption
type PayloadOptions ¶ added in v1.5.0
type PayloadOptions struct { Handler HandlerType UserStruct any PayloadType PayloadTypes }
type PayloadTypes ¶ added in v1.5.0
type PayloadTypes int
const ( BYTES PayloadTypes = iota + 1 JSON )