func NewEncodeDecodeWrapper(processor base.DataProcessor) base.DataProcessor {
	return base.ProcessorFunc(func(data []byte, ctx *base.DataProcessorContext) ([]byte, error) {
		decodedData, err := utils.DecodeEscaped(data)
		if err != nil {
			logrus.WithError(err).Debugln("Data is not in hex/escape format, process as binary data (used in prepared statements)")
			decodedData.Set(data)
		}
		data, err = processor.Process(decodedData.Data(), ctx)
		if err != nil {
			return data, err
		}
		for _, c := range data {
			if !utils.IsPrintableEscapeChar(c) {
				output := make([]byte, len(HexPrefix)+hex.EncodedLen(len(data)))
				copy(output, HexPrefix)
				hex.Encode(output[len(HexPrefix):], data)
				data = output
				break
			}
		}
		return data, nil
	})
}
NewEncodeDecodeWrapper encode/decode data to/from escaped format (hex/octal)
package postgresql
import (
	"encoding/hex"
	"github.com/cossacklabs/acra/decryptor/base"
	"github.com/cossacklabs/acra/utils"
	"github.com/sirupsen/logrus"
)