2
0

Add *Conn. CopyFromTextual, CopyToTextual, which use textual format for copying data

This commit is contained in:
Murat Kabilov
2018-07-30 17:29:26 +02:00
parent b3d0cbd0e6
commit 5f39bbaf35
2 changed files with 33 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package pgproto3
import (
"encoding/json"
)
type CopyDone struct {
}
func (*CopyDone) Backend() {}
func (dst *CopyDone) Decode(src []byte) error {
if len(src) != 0 {
return &invalidMessageLenErr{messageType: "CopyDone", expectedLen: 0, actualLen: len(src)}
}
return nil
}
func (src *CopyDone) Encode(dst []byte) []byte {
return append(dst, 'c', 0, 0, 0, 4)
}
func (src *CopyDone) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Type string
}{
Type: "CopyDone",
})
}