Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 661 | |
| 662 | // Format implements the NodeFormatter interface. |
| 663 | func (d *DBytes) Format(ctx *FmtCtx) { |
| 664 | f := ctx.flags |
| 665 | if f.HasFlags(fmtPgwireFormat) { |
| 666 | ctx.WriteString(`"\\x`) |
| 667 | writeAsHexString(ctx, d) |
| 668 | ctx.WriteString(`"`) |
| 669 | } else { |
| 670 | withQuotes := !f.HasFlags(FmtFlags(lex.EncBareStrings)) |
| 671 | if withQuotes { |
| 672 | if f.HasFlags(fmtFormatByteLiterals) { |
| 673 | ctx.WriteByte('b') |
| 674 | } |
| 675 | ctx.WriteByte('\'') |
| 676 | } |
| 677 | ctx.WriteString("\\x") |
| 678 | writeAsHexString(ctx, d) |
| 679 | if withQuotes { |
| 680 | ctx.WriteByte('\'') |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | // Size implements the Datum interface. |
| 686 | func (d *DBytes) Size() uintptr { |
nothing calls this directly
no test coverage detected