Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 3430 | |
| 3431 | // Format implements the NodeFormatter interface. |
| 3432 | func (d *DArray) Format(ctx *FmtCtx) { |
| 3433 | if ctx.HasFlags(fmtPgwireFormat) { |
| 3434 | d.pgwireFormat(ctx) |
| 3435 | return |
| 3436 | } |
| 3437 | |
| 3438 | // If we want to export arrays, we need to ensure that |
| 3439 | // the datums within the arrays are formatted with enclosing quotes etc. |
| 3440 | if ctx.HasFlags(FmtExport) { |
| 3441 | oldFlags := ctx.flags |
| 3442 | ctx.flags = oldFlags & ^FmtExport | FmtParsable |
| 3443 | defer func() { ctx.flags = oldFlags }() |
| 3444 | } |
| 3445 | |
| 3446 | ctx.WriteString("ARRAY[") |
| 3447 | comma := "" |
| 3448 | for _, v := range d.Array { |
| 3449 | ctx.WriteString(comma) |
| 3450 | ctx.FormatNode(v) |
| 3451 | comma = "," |
| 3452 | } |
| 3453 | ctx.WriteByte(']') |
| 3454 | } |
| 3455 | |
| 3456 | const maxArrayLength = math.MaxInt32 |
| 3457 |
nothing calls this directly
no test coverage detected