...
1 package pgproto3
2
3 import (
4 "encoding/json"
5 )
6
7 type Flush struct{}
8
9
10 func (*Flush) Frontend() {}
11
12
13
14 func (dst *Flush) Decode(src []byte) error {
15 if len(src) != 0 {
16 return &invalidMessageLenErr{messageType: "Flush", expectedLen: 0, actualLen: len(src)}
17 }
18
19 return nil
20 }
21
22
23 func (src *Flush) Encode(dst []byte) ([]byte, error) {
24 return append(dst, 'H', 0, 0, 0, 4), nil
25 }
26
27
28 func (src Flush) MarshalJSON() ([]byte, error) {
29 return json.Marshal(struct {
30 Type string
31 }{
32 Type: "Flush",
33 })
34 }
35
View as plain text