Add adds one or more fields to the current list. By default this method will try to REPLACE existing fields with the new ones by their id or by their name if the new field doesn't have an explicit id. If no matching existing field is found, it will APPEND the field to the end of the list. In all
(fields ...Field)
| 116 | // In all cases, if any of the new fields don't have an explicit id it will auto generate a default one for them |
| 117 | // (the id value doesn't really matter and it is mostly used as a stable identifier in case of a field rename). |
| 118 | func (l *FieldsList) Add(fields ...Field) { |
| 119 | for _, f := range fields { |
| 120 | l.add(-1, f) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // AddAt is the same as Add but insert/move the fields at the specific position. |
| 125 | // |