#97 add As for all interface.
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled

This commit is contained in:
Gorbunov Kirill Andreevich 2024-02-27 23:24:51 +03:00
parent d07ac67300
commit 781cada47b

View File

@ -8,7 +8,6 @@ import (
"go.unistack.org/micro/v3/broker" "go.unistack.org/micro/v3/broker"
"go.unistack.org/micro/v3/fsm" "go.unistack.org/micro/v3/fsm"
"go.unistack.org/micro/v3/options"
) )
func TestAs(t *testing.T) { func TestAs(t *testing.T) {
@ -66,7 +65,8 @@ type bro struct {
} }
func (p *bro) Name() string { return p.name } func (p *bro) Name() string { return p.name }
func (p *bro) Init(opts ...options.Option) error { return nil }
func (p *bro) Init(opts ...broker.Option) error { return nil }
// Options returns broker options // Options returns broker options
func (p *bro) Options() broker.Options { return broker.Options{} } func (p *bro) Options() broker.Options { return broker.Options{} }
@ -81,10 +81,22 @@ func (p *bro) Connect(ctx context.Context) error { return nil }
func (p *bro) Disconnect(ctx context.Context) error { return nil } func (p *bro) Disconnect(ctx context.Context) error { return nil }
// Publish message, msg can be single broker.Message or []broker.Message // Publish message, msg can be single broker.Message or []broker.Message
func (p *bro) Publish(ctx context.Context, msg interface{}, opts ...options.Option) error { return nil } func (p *bro) Publish(ctx context.Context, topic string, msg *broker.Message, opts ...broker.PublishOption) error {
return nil
}
// BatchPublish messages to broker with multiple topics
func (p *bro) BatchPublish(ctx context.Context, msgs []*broker.Message, opts ...broker.PublishOption) error {
return nil
}
// BatchSubscribe subscribes to topic messages via handler
func (p *bro) BatchSubscribe(ctx context.Context, topic string, h broker.BatchHandler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {
return nil, nil
}
// Subscribe subscribes to topic message via handler // Subscribe subscribes to topic message via handler
func (p *bro) Subscribe(ctx context.Context, topic string, handler interface{}, opts ...options.Option) (broker.Subscriber, error) { func (p *bro) Subscribe(ctx context.Context, topic string, handler broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {
return nil, nil return nil, nil
} }