You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
404 B
30 lines
404 B
3 years ago
|
package field
|
||
|
|
||
|
type Fields []Field
|
||
|
|
||
|
type MapField map[Key]Value
|
||
|
|
||
|
func (f Fields) Append(fields ...Field) Fields {
|
||
|
f = append(f, fields...)
|
||
|
|
||
|
return f
|
||
|
}
|
||
|
|
||
|
func (f Fields) Set(idx int, field Field) {
|
||
|
f[idx] = field
|
||
|
}
|
||
|
|
||
|
func (f Fields) Len() int {
|
||
|
return len(f)
|
||
|
}
|
||
|
|
||
|
func (f Fields) AsMap() MapField {
|
||
|
m := make(MapField, len(f))
|
||
|
|
||
|
for _, field := range f {
|
||
|
m[field.Key()] = field.Value()
|
||
|
}
|
||
|
|
||
|
return m
|
||
|
}
|