(ctx context.Context, p string)
| 1656 | } |
| 1657 | |
| 1658 | func (tmplContext *BulkTemplateContext) binAppendString(ctx context.Context, p string) (err error) { |
| 1659 | if debugEncoding { |
| 1660 | logDebug(ctx, "append %d STRING = %s", tmplContext.binDepth, p) |
| 1661 | } |
| 1662 | actualLen := uint32(len(p)) |
| 1663 | if tmplContext.NoteFormat == BulkNoteFormatFlexNano { |
| 1664 | if actualLen > 255 { |
| 1665 | err = fmt.Errorf("compact mode only supports strings up to 255 bytes") |
| 1666 | } else { |
| 1667 | err = tmplContext.binAppendUint8(ctx, uint8(actualLen)) |
| 1668 | if err == nil { |
| 1669 | err = tmplContext.binAppendUint8s(ctx, []uint8(p), actualLen) |
| 1670 | } |
| 1671 | } |
| 1672 | } else { |
| 1673 | if actualLen > 65535 { |
| 1674 | err = fmt.Errorf("strings must be smaller than up to 65535 bytes") |
| 1675 | } else { |
| 1676 | err = tmplContext.binAppendUint16(ctx, uint16(actualLen)) |
| 1677 | if err == nil { |
| 1678 | err = tmplContext.binAppendUint8s(ctx, []uint8(p), actualLen) |
| 1679 | } |
| 1680 | } |
| 1681 | } |
| 1682 | return err |
| 1683 | } |
| 1684 | |
| 1685 | func (tmplContext *BulkTemplateContext) binAppendReal16(ctx context.Context, number float32) (err error) { |
| 1686 | if debugEncoding { |
no test coverage detected