package pgproto3
import (
)
type CommandComplete struct {
CommandTag []byte
}
func (*CommandComplete) () {}
func ( *CommandComplete) ( []byte) error {
:= bytes.IndexByte(, 0)
if == -1 {
return &invalidMessageFormatErr{messageType: "CommandComplete", details: "unterminated string"}
}
if != len()-1 {
return &invalidMessageFormatErr{messageType: "CommandComplete", details: "string terminated too early"}
}
.CommandTag = [:]
return nil
}
func ( *CommandComplete) ( []byte) ([]byte, error) {
, := beginMessage(, 'C')
= append(, .CommandTag...)
= append(, 0)
return finishMessage(, )
}
func ( CommandComplete) () ([]byte, error) {
return json.Marshal(struct {
string
string
}{
: "CommandComplete",
: string(.CommandTag),
})
}
func ( *CommandComplete) ( []byte) error {
if string() == "null" {
return nil
}
var struct {
string
}
if := json.Unmarshal(, &); != nil {
return
}
.CommandTag = []byte(.)
return nil
}