func KeySliceRecord(key, value []byte) *Record {
	return &Record{Key: key, Value: value}
}
KeySliceRecord returns a Record with the Key and Value fields set to the
input key and value slices. For producing, this function is useful in
tandem with the client-level ProduceTopic option.
package kgo
import (
	"reflect"
	"time"
	"unsafe"
)
type RecordHeader struct {
	Key   string
	Value []byte
}
type RecordAttrs struct {
	attrs uint8
}
func (a RecordAttrs) TimestampType() int8 {
	if a.attrs&0b1000_0000 != 0 {
		return -1
	}
	return int8(a.attrs & 0b0000_1000)
}
func (a RecordAttrs) CompressionType() uint8 {
	return a.attrs & 0b0000_0111
}
func (a RecordAttrs) IsTransactional() bool {
	return a.attrs&0b0001_0000 != 0
}
func (a RecordAttrs) IsControl() bool {
	return a.attrs&0b0010_0000 != 0
}
type Record struct {
	Key []byte
	Value []byte
	Headers []RecordHeader
	Timestamp time.Time
	Topic string
	Partition int32
	Attrs RecordAttrs
	ProducerEpoch int16
	ProducerID int64
	LeaderEpoch int32
	Offset int64
}
func (r *Record) AppendFormat(b []byte, layout string) ([]byte, error) {
	f, err := NewRecordFormatter(layout)
	if err != nil {
		return b, err
	}
	return f.AppendRecord(b, r), nil
}
func StringRecord(value string) *Record {
	var slice []byte
	slicehdr := (*reflect.SliceHeader)(unsafe.Pointer(&slice))
	slicehdr.Data = ((*reflect.StringHeader)(unsafe.Pointer(&value))).Data
	slicehdr.Len = len(value)
	slicehdr.Cap = len(value)
	return &Record{Value: slice}
}
func KeyStringRecord(key, value string) *Record {
	r := StringRecord(value)
	keyhdr := (*reflect.SliceHeader)(unsafe.Pointer(&r.Key))
	keyhdr.Data = ((*reflect.StringHeader)(unsafe.Pointer(&key))).Data
	keyhdr.Len = len(key)
	keyhdr.Cap = len(key)
	return r
}
func SliceRecord(value []byte) *Record {
	return &Record{Value: value}
}