1 Star 0 Fork 0

SasukeBo/go-micro

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
options.go 1.03 KB
Copy Edit Raw Blame History
汪波 authored 2023-02-23 10:27 . fix: 替换包名
package segmentio
import (
"context"
"gitee.com/sasukebo/go-micro/v4/broker"
"github.com/segmentio/kafka-go"
)
var (
DefaultReaderConfig = kafka.WriterConfig{}
DefaultWriterConfig = kafka.ReaderConfig{}
)
type readerConfigKey struct{}
type writerConfigKey struct{}
func ReaderConfig(c kafka.ReaderConfig) broker.Option {
return setBrokerOption(readerConfigKey{}, c)
}
func WriterConfig(c kafka.WriterConfig) broker.Option {
return setBrokerOption(writerConfigKey{}, c)
}
type subscribeContextKey struct{}
// SubscribeContext set the context for broker.SubscribeOption
func SubscribeContext(ctx context.Context) broker.SubscribeOption {
return setSubscribeOption(subscribeContextKey{}, ctx)
}
type subscribeReaderConfigKey struct{}
func SubscribeReaderConfig(c kafka.ReaderConfig) broker.SubscribeOption {
return setSubscribeOption(subscribeReaderConfigKey{}, c)
}
type subscribeWriterConfigKey struct{}
func SubscribeWriterConfig(c kafka.WriterConfig) broker.SubscribeOption {
return setSubscribeOption(subscribeWriterConfigKey{}, c)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sasukebo/go-micro.git
git@gitee.com:sasukebo/go-micro.git
sasukebo
go-micro
go-micro
6e18eb58b836

Search