loveuer e5ae2efcef fix: update user nickname;
feat: add database/kafka.
2024-12-04 15:49:37 +08:00

43 lines
691 B
Go

package kafka
import (
"ultone/internal/interfaces"
"github.com/segmentio/kafka-go/sasl/plain"
)
type OptionFn func(*client)
func WithPlainAuth(username, password string) OptionFn {
return func(c *client) {
c.mechanism = plain.Mechanism{
Username: username,
Password: password,
}
}
}
func WithTopic(topic string) OptionFn {
return func(c *client) {
c.topic = topic
}
}
func WithPartition(partition int) OptionFn {
return func(c *client) {
c.partition = partition
}
}
func WithReconnection() OptionFn {
return func(c *client) {
c.reconnection = true
}
}
func WithLogger(logger interfaces.Logger) OptionFn {
return func(c *client) {
c.logger = logger
}
}