func (packet *ParsePacket) Zeroize() {
	utils.ZeroizeBytes(packet.query)
}
Zeroize sensitive data in the packet.
package postgresql
import (
	"bytes"
	"encoding/binary"
	"errors"
	"math"
	"github.com/cossacklabs/acra/decryptor/base"
	"github.com/cossacklabs/acra/utils"
	log "github.com/sirupsen/logrus"
)
var terminator = []byte{0}
var ErrTerminatorNotFound = errors.New("invalid string, terminator not found")
var ErrPacketTruncated = errors.New("invalid packet, too short")
var ErrArrayTooBig = errors.New("array too big")
func FetchQueryFromParse(data []byte) ([]byte, error) {
	startIndex := bytes.Index(data, terminator)
	if startIndex == -1 {
		return nil, ErrTerminatorNotFound
	}
	startIndex++
	endIndex := bytes.Index(data[startIndex:], terminator)
	if endIndex == -1 {
		return nil, ErrTerminatorNotFound
	}
	endIndex += startIndex
	return data[startIndex : endIndex+1], nil
}
type objectID []byte
type paramsNum []byte
func (num paramsNum) ToInt() int {
	return int(binary.BigEndian.Uint16(num))
}
type ParsePacket struct {
	name  []byte
	query []byte
	paramsNum paramsNum
	params []objectID
}
func (packet *ParsePacket) Marshal() []byte {
	output := make([]byte, 0, packet.Length())
	output = append(output, packet.name...)
	output = append(output, packet.query...)
	output = append(output, packet.paramsNum...)
	for _, param := range packet.params {
		output = append(output, param...)
	}
	return output
}
func (packet *ParsePacket) Length() int {
	return len(packet.name) + len(packet.query) + len(packet.paramsNum) + (4 * len(packet.params))
}
func (packet *ParsePacket) Name() string {
	return string(packet.name[:len(packet.name)-1])
}
func (packet *ParsePacket) QueryString() string {
	return string(packet.query[:len(packet.query)-1])
}
func (packet *ParsePacket) ReplaceQuery(newQuery string) {
	packet.query = append([]byte(newQuery), 0)
}