func DirectWrite(
	ctx context.Context,
	message MessageReader,
	structuredWriter StructuredWriter,
	binaryWriter BinaryWriter,
	transformers ...Transformer,
) (Encoding, error) {
	if structuredWriter != nil && len(transformers) == 0 && !GetOrDefaultFromCtx(ctx, skipDirectStructuredEncoding, false).(bool) {
		if err := message.ReadStructured(ctx, structuredWriter); err == nil {
			return EncodingStructured, nil
		} else if err != ErrNotStructured {
			return EncodingStructured, err
		}
	}
	if binaryWriter != nil && !GetOrDefaultFromCtx(ctx, skipDirectBinaryEncoding, false).(bool) && message.ReadEncoding() == EncodingBinary {
		return EncodingBinary, writeBinaryWithTransformer(ctx, message, binaryWriter, transformers)
	}
	return EncodingUnknown, ErrUnknownEncoding
}
DirectWrite invokes the encoders. structuredWriter and binaryWriter could be nil if the protocol doesn't support it.
transformers can be nil and this function guarantees that they are invoked only once during the encoding process.
This function MUST be invoked only if message.ReadEncoding() == EncodingBinary or message.ReadEncoding() == EncodingStructured

Returns:
* EncodingStructured, nil if message is correctly encoded in structured encoding
* EncodingBinary, nil if message is correctly encoded in binary encoding
* EncodingStructured, err if message was structured but error happened during the encoding
* EncodingBinary, err if message was binary but error happened during the encoding
* EncodingUnknown, ErrUnknownEncoding if message is not a structured or a binary Message
package binding
import (
	"context"
	"github.com/cloudevents/sdk-go/v2/event"
)
type eventEncodingKey int
const (
	skipDirectStructuredEncoding eventEncodingKey = iota
	skipDirectBinaryEncoding
	preferredEventEncoding
)