| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package codec |
| 9 |
|
| 10 |
import "reflect" |
| 11 |
|
| 12 |
type mapIter struct { |
| 13 |
t *reflect.MapIter |
| 14 |
m reflect.Value |
| 15 |
values bool |
| 16 |
} |
| 17 |
|
| 18 |
func (t *mapIter) Next() (r bool) { |
| 19 |
return t.t.Next() |
| 20 |
} |
| 21 |
|
| 22 |
func (t *mapIter) Key() reflect.Value { |
| 23 |
return t.t.Key() |
| 24 |
} |
| 25 |
|
| 26 |
func (t *mapIter) Value() (r reflect.Value) { |
| 27 |
if t.values { |
| 28 |
return t.t.Value() |
| 29 |
} |
| 30 |
return |
| 31 |
} |
| 32 |
|
| 33 |
func (t *mapIter) Done() {} |
| 34 |
|
| 35 |
func mapRange(t *mapIter, m, k, v reflect.Value, values bool) { |
| 36 |
*t = mapIter{ |
| 37 |
m: m, |
| 38 |
t: m.MapRange(), |
| 39 |
values: values, |
| 40 |
} |
| 41 |
} |