|
|
@@ -62,8 +62,8 @@ type Encoder interface {
|
|
|
// make strings and byte slices encodable for convenience so they can be used as keys
|
|
|
// and/or values in kafka messages
|
|
|
|
|
|
-// StringEncoder implements the Encoder interface for Go strings so that you can do things like
|
|
|
-// producer.SendMessage(nil, sarama.StringEncoder("hello world"))
|
|
|
+// StringEncoder implements the Encoder interface for Go strings so that they can be used
|
|
|
+// as the Key or Value in a ProducerMessage.
|
|
|
type StringEncoder string
|
|
|
|
|
|
func (s StringEncoder) Encode() ([]byte, error) {
|
|
|
@@ -74,8 +74,8 @@ func (s StringEncoder) Length() int {
|
|
|
return len(s)
|
|
|
}
|
|
|
|
|
|
-// ByteEncoder implements the Encoder interface for Go byte slices so that you can do things like
|
|
|
-// producer.SendMessage(nil, sarama.ByteEncoder([]byte{0x00}))
|
|
|
+// ByteEncoder implements the Encoder interface for Go byte slices so that they can be used
|
|
|
+// as the Key or Value in a ProducerMessage.
|
|
|
type ByteEncoder []byte
|
|
|
|
|
|
func (b ByteEncoder) Encode() ([]byte, error) {
|