AddMarshaledJSONAt is the same as AddMarshaledJSON but insert/move the fields at the specific position. If pos < 0, then this method acts the same as calling AddMarshaledJSON. If pos > FieldsList total items, then the specified fields are inserted/moved at the end of the list.
(pos int, rawJSON []byte)
| 168 | // |
| 169 | // If pos > FieldsList total items, then the specified fields are inserted/moved at the end of the list. |
| 170 | func (l *FieldsList) AddMarshaledJSONAt(pos int, rawJSON []byte) error { |
| 171 | extractedFields, err := marshaledJSONtoFieldsList(rawJSON) |
| 172 | if err != nil { |
| 173 | return err |
| 174 | } |
| 175 | |
| 176 | l.AddAt(pos, extractedFields...) |
| 177 | |
| 178 | return nil |
| 179 | } |
| 180 | |
| 181 | func marshaledJSONtoFieldsList(rawJSON []byte) (FieldsList, error) { |
| 182 | extractedFields := FieldsList{} |