Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 1696 | |
| 1697 | // Format implements the NodeFormatter interface. |
| 1698 | func (d *DArray) Format(ctx *FmtCtx) { |
| 1699 | if ctx.HasFlags(fmtPgwireFormat) { |
| 1700 | d.pgwireFormat(ctx) |
| 1701 | return |
| 1702 | } |
| 1703 | |
| 1704 | // If we want to export arrays, we need to ensure that |
| 1705 | // the datums within the arrays are formatted with enclosing quotes etc. |
| 1706 | if ctx.HasFlags(FmtExport) { |
| 1707 | oldFlags := ctx.flags |
| 1708 | ctx.flags = oldFlags & ^FmtExport | FmtParsable |
| 1709 | defer func() { ctx.flags = oldFlags }() |
| 1710 | } |
| 1711 | |
| 1712 | ctx.WriteString("ARRAY[") |
| 1713 | comma := "" |
| 1714 | for _, v := range d.Array { |
| 1715 | ctx.WriteString(comma) |
| 1716 | ctx.FormatNode(v) |
| 1717 | comma = "," |
| 1718 | } |
| 1719 | ctx.WriteByte(']') |
| 1720 | } |
| 1721 | |
| 1722 | const maxArrayLength = math.MaxInt32 |
| 1723 |
nothing calls this directly
no test coverage detected