fix: update user nickname;
feat: add database/kafka.
This commit is contained in:
42
internal/database/kafka/option.go
Normal file
42
internal/database/kafka/option.go
Normal file
@@ -0,0 +1,42 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user