package pgproto3
import (
)
type SASLResponse struct {
Data []byte
}
func (*SASLResponse) () {}
func ( *SASLResponse) ( []byte) error {
* = SASLResponse{Data: }
return nil
}
func ( *SASLResponse) ( []byte) ([]byte, error) {
, := beginMessage(, 'p')
= append(, .Data...)
return finishMessage(, )
}
func ( SASLResponse) () ([]byte, error) {
return json.Marshal(struct {
string
string
}{
: "SASLResponse",
: string(.Data),
})
}
func ( *SASLResponse) ( []byte) error {
var struct {
string
}
if := json.Unmarshal(, &); != nil {
return
}
if . != "" {
, := hex.DecodeString(.)
if != nil {
return
}
.Data =
}
return nil
}