-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added method extract and options in message
- Loading branch information
1 parent
4538ea2
commit 623ca4c
Showing
8 changed files
with
30 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
package goeventbus | ||
|
||
type Message struct { | ||
Data interface{} | ||
Options MessageOptions | ||
Data interface{} | ||
MessageOptions MessageOptions | ||
} | ||
|
||
func CreateMessage() Message { | ||
return Message{} | ||
} | ||
|
||
func (m Message) SetBody(data interface{}) Message { | ||
func (m Message) SetBody(data any) Message { | ||
m.Data = data | ||
return m | ||
} | ||
|
||
func (m Message) SetOptions(options MessageOptions) Message { | ||
m.Options = options | ||
m.MessageOptions = options | ||
return m | ||
} | ||
|
||
func (m Message) Extract() any { | ||
return m.Data | ||
} | ||
|
||
func (m Message) Options() MessageOptions { | ||
return m.MessageOptions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package goeventbus | ||
|
||
type Request struct { | ||
Channel string `json:"channel"` | ||
Message Message `json:"message"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters