Source File
authentication_sasl_final.go
Belonging Package
github.com/jackc/pgx/v5/pgproto3
package pgproto3
import (
)
// AuthenticationSASLFinal is a message sent from the backend indicating a SASL authentication has completed.
type AuthenticationSASLFinal struct {
Data []byte
}
// Backend identifies this message as sendable by the PostgreSQL backend.
func (*AuthenticationSASLFinal) () {}
// Backend identifies this message as an authentication response.
func (*AuthenticationSASLFinal) () {}
// 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 ( *AuthenticationSASLFinal) ( []byte) error {
if len() < 4 {
return errors.New("authentication message too short")
}
:= binary.BigEndian.Uint32()
if != AuthTypeSASLFinal {
return errors.New("bad auth type")
}
.Data = [4:]
return nil
}
// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
func ( *AuthenticationSASLFinal) ( []byte) []byte {
= append(, 'R')
:= len()
= pgio.AppendInt32(, -1)
= pgio.AppendUint32(, AuthTypeSASLFinal)
= append(, .Data...)
pgio.SetInt32([:], int32(len([:])))
return
}
// MarshalJSON implements encoding/json.Unmarshaler.
func ( AuthenticationSASLFinal) () ([]byte, error) {
return json.Marshal(struct {
string
string
}{
: "AuthenticationSASLFinal",
: string(.Data),
})
}
// UnmarshalJSON implements encoding/json.Unmarshaler.
func ( *AuthenticationSASLFinal) ( []byte) error {
// Ignore null, like in the main JSON package.
if string() == "null" {
return nil
}
var struct {
string
}
if := json.Unmarshal(, &); != nil {
return
}
.Data = []byte(.)
return nil
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |