writeCopyInResponse tells client to send COPY data
(w io.Writer, numColumns int16, textFormat bool)
| 360 | data = append(data, 1) |
| 361 | } |
| 362 | |
| 363 | // Number of columns |
| 364 | colBytes := make([]byte, 2) |
| 365 | binary.BigEndian.PutUint16(colBytes, uint16(numColumns)) |
| 366 | data = append(data, colBytes...) |
| 367 | |
| 368 | // Format for each column (0=text) |
| 369 | for i := int16(0); i < numColumns; i++ { |
| 370 | formatBytes := make([]byte, 2) |
| 371 | if textFormat { |
| 372 | binary.BigEndian.PutUint16(formatBytes, 0) |
| 373 | } else { |
| 374 | binary.BigEndian.PutUint16(formatBytes, 1) |
| 375 | } |
| 376 | data = append(data, formatBytes...) |
| 377 | } |
| 378 | |
| 379 | return WriteMessage(w, MsgCopyOutResponse, data) |
| 380 | } |
| 381 | |
| 382 | // writeCopyInResponse tells client to send COPY data |
| 383 | func WriteCopyInResponse(w io.Writer, numColumns int16, textFormat bool) error { |
| 384 | var data []byte |
| 385 | |
| 386 | // Overall format (0=text) |
| 387 | if textFormat { |
| 388 | data = append(data, 0) |
| 389 | } else { |
| 390 | data = append(data, 1) |
| 391 | } |
| 392 |
no test coverage detected