(w jsWriter, msg []byte, scratch []byte, depth int)
| 144 | } |
| 145 | |
| 146 | func rwMapKeyBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) { |
| 147 | if len(msg) < 1 { |
| 148 | return msg, scratch, ErrShortBytes |
| 149 | } |
| 150 | switch getType(msg[0]) { |
| 151 | case IntType: |
| 152 | i, msg, err := ReadInt64Bytes(msg) |
| 153 | if err != nil { |
| 154 | return msg, scratch, err |
| 155 | } |
| 156 | scratch = strconv.AppendInt(scratch[:0], i, 10) |
| 157 | _, err = rwquoted(w, scratch) |
| 158 | return msg, scratch, err |
| 159 | case UintType: |
| 160 | u, msg, err := ReadUint64Bytes(msg) |
| 161 | if err != nil { |
| 162 | return msg, scratch, err |
| 163 | } |
| 164 | scratch = strconv.AppendUint(scratch[:0], u, 10) |
| 165 | _, err = rwquoted(w, scratch) |
| 166 | return msg, scratch, err |
| 167 | } |
| 168 | msg, scratch, err := rwStringBytes(w, msg, scratch, depth) |
| 169 | if err != nil { |
| 170 | if tperr, ok := err.(TypeError); ok && tperr.Encoded == BinType { |
| 171 | return rwBytesBytes(w, msg, scratch, depth) |
| 172 | } |
| 173 | } |
| 174 | return msg, scratch, err |
| 175 | } |
| 176 | |
| 177 | func rwStringBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) { |
| 178 | str, msg, err := ReadStringZC(msg) |
no test coverage detected
searching dependent graphs…