ResolveBlankPaddedChar pads the given string with spaces if blank padding is required or returns the string unmodified otherwise.
(s string, t *types.T)
| 28 | // ResolveBlankPaddedChar pads the given string with spaces if blank padding is |
| 29 | // required or returns the string unmodified otherwise. |
| 30 | func ResolveBlankPaddedChar(s string, t *types.T) string { |
| 31 | if t.Oid() == oid.T_bpchar && len(s) < int(t.Width()) { |
| 32 | // Pad spaces on the right of the string to make it of length specified |
| 33 | // in the type t. |
| 34 | res := make([]byte, t.Width()) |
| 35 | copy(res, s) |
| 36 | pad := res[len(s):] |
| 37 | for len(pad) > len(spaces) { |
| 38 | copy(pad, spaces) |
| 39 | pad = pad[len(spaces):] |
| 40 | } |
| 41 | copy(pad, spaces) |
| 42 | return encoding.UnsafeConvertBytesToString(res) |
| 43 | } |
| 44 | return s |
| 45 | } |
| 46 | |
| 47 | func (d *DTuple) pgwireFormat(ctx *FmtCtx) { |
| 48 | // When converting a tuple to text in "postgres mode" there is |
no test coverage detected
searching dependent graphs…