-
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.
implement subscription decoders, improve generated handler
- Loading branch information
1 parent
bc318ed
commit 65257f7
Showing
8 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 +1,22 @@ | ||
package amqp | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/go-godin/rabbitmq" | ||
|
||
pb "{{ .Protobuf.Package }}" | ||
) | ||
|
||
{{- if gt (len .Service.Subscriber) 0 }} | ||
type SubcriptionDecoder func(delivery *rabbitmq.Delivery) (decoded interface{}, err error) | ||
{{- end }} | ||
|
||
{{- if gt (len .Service.Publisher) 0 }} | ||
{{- range .Service.Publisher }} | ||
{{- template "amqp_publish_encode" . }} | ||
{{- template "amqp_publish_encode" . -}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if gt (len .Service.Subscriber) 0 }} | ||
{{- range .Service.Subscriber }} | ||
{{- template "amqp_subscribe_decode" . -}} | ||
{{- end }} | ||
{{- end }} | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{- define "amqp_subscribe_decode" }} | ||
// {{ .Handler }}Decoder | ||
func {{ .Handler }}Decoder(delivery *rabbitmq.Delivery) (decoded interface{}, err error) { | ||
return nil, fmt.Errorf("{{ .Handler }}Decoder is not implemented") | ||
} | ||
{{- end }} |