package pgproto3

import (
	
	

	
)

type Describe struct {
	ObjectType byte // 'S' = prepared statement, 'P' = portal
	Name       string
}
Frontend identifies this message as sendable by a PostgreSQL frontend.
func (*Describe) () {}
Decode decodes src into dst. src must contain the complete message with the exception of the initial 1 byte message type identifier and 4 byte message length.
func ( *Describe) ( []byte) error {
	if len() < 2 {
		return &invalidMessageFormatErr{messageType: "Describe"}
	}

	.ObjectType = [0]
	 := 1

	 := bytes.IndexByte([:], 0)
	if  != len([:])-1 {
		return &invalidMessageFormatErr{messageType: "Describe"}
	}

	.Name = string([ : len()-1])

	return nil
}
Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
func ( *Describe) ( []byte) []byte {
	 = append(, 'D')
	 := len()
	 = pgio.AppendInt32(, -1)

	 = append(, .ObjectType)
	 = append(, .Name...)
	 = append(, 0)

	pgio.SetInt32([:], int32(len([:])))

	return 
}
MarshalJSON implements encoding/json.Marshaler.
func ( Describe) () ([]byte, error) {
	return json.Marshal(struct {
		       string
		 string
		       string
	}{
		:       "Describe",
		: string(.ObjectType),
		:       .Name,
	})