func PackEOF(e *EOF) []byte {
	buf := common.NewBuffer(64)
	buf.WriteU8(EOF_PACKET)
	buf.WriteU16(e.Warnings)
	buf.WriteU16(e.StatusFlags)
	return buf.Datas()
}
PackEOF used to pack the EOF packet.
package proto
import (
	"github.com/xelabs/go-mysqlstack/sqldb"
	"github.com/xelabs/go-mysqlstack/sqlparser/depends/common"
)
const (
	EOF_PACKET byte = 0xfe
)
type EOF struct {
	Header      byte  
	Warnings    uint16
	StatusFlags uint16
}
func UnPackEOF(data []byte) (*EOF, error) {
	var err error
	e := &EOF{}
	buf := common.ReadBuffer(data)
	if e.Header, err = buf.ReadU8(); err != nil {
		return nil, sqldb.NewSQLErrorf(sqldb.ER_MALFORMED_PACKET, "invalid eof packet header: %v", data)
	}
	if e.Header != EOF_PACKET {
		return nil, sqldb.NewSQLErrorf(sqldb.ER_MALFORMED_PACKET, "invalid oeof packet header: %v", e.Header)
	}
	if e.Warnings, err = buf.ReadU16(); err != nil {
		return nil, sqldb.NewSQLErrorf(sqldb.ER_MALFORMED_PACKET, "invalid eof packet warnings: %v", data)
	}
	if e.StatusFlags, err = buf.ReadU16(); err != nil {
		return nil, sqldb.NewSQLErrorf(sqldb.ER_MALFORMED_PACKET, "invalid eof packet statusflags: %v", data)
	}
	return e, nil
}