add compile-time interface compliance check

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-10-18 10:40:59 +03:00
committed by github-actions[bot]
parent fa00663740
commit b122fed3cc
2 changed files with 140 additions and 7 deletions

44
message.go Normal file
View File

@@ -0,0 +1,44 @@
package http
import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
)
type httpEvent struct {
payload interface{}
topic string
contentType string
opts client.MessageOptions
}
func newHTTPEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
options := client.NewMessageOptions(opts...)
if len(options.ContentType) > 0 {
contentType = options.ContentType
}
return &httpEvent{
payload: payload,
topic: topic,
contentType: contentType,
opts: options,
}
}
func (c *httpEvent) ContentType() string {
return c.contentType
}
func (c *httpEvent) Topic() string {
return c.topic
}
func (c *httpEvent) Payload() interface{} {
return c.payload
}
func (c *httpEvent) Metadata() metadata.Metadata {
return c.opts.Metadata
}