@@ -30,13 +30,18 @@ type apiArrayEntry struct {
3030	entry  Navigatable 
3131}
3232
33+ // MarshalJSON forwards to the inner array entry 
34+ func  (a  * apiArrayEntry ) MarshalJSON () ([]byte , error ) {
35+ 	return  json .Marshal (a .entry )
36+ }
37+ 
3338// Array represents an array of entries in the API accessible through a 
3439// primary key 
3540// Thread safe 
3641type  Array  struct  {
3742	mutex     sync.RWMutex 
3843	entryMap  map [string ]* apiArrayEntry 
39- 	entries   []Navigatable 
44+ 	entries   []* apiArrayEntry 
4045}
4146
4247// AddEntry a new array entry 
@@ -59,7 +64,7 @@ func (a *Array) AddEntry(key string, entry Navigatable) {
5964
6065	a .entryMap [key ] =  arrayEntry 
6166
62- 	a .entries  =  append (a .entries , entry )
67+ 	a .entries  =  append (a .entries , arrayEntry )
6368}
6469
6570// RemoveEntry removes an array entry 
@@ -79,6 +84,7 @@ func (a *Array) RemoveEntry(key string) {
7984	delete (a .entryMap , key )
8085	for  i  :=  entry .row ; i + 1  <  len (a .entries ); i ++  {
8186		a .entries [i ] =  a .entries [i + 1 ]
87+ 		a .entries [i ].row -- 
8288	}
8389	a .entries  =  a .entries [:len (a .entries )- 1 ]
8490}
@@ -106,7 +112,7 @@ func (a *Array) Get(path string) (Navigatable, error) {
106112		return  nil , nil 
107113	}
108114
109- 	return  a .entries [entryNum ], nil 
115+ 	return  a .entries [entryNum ]. entry , nil 
110116}
111117
112118// Call an API 
@@ -173,7 +179,7 @@ func (a *Array) Update() error {
173179	defer  a .mutex .RUnlock ()
174180
175181	for  _ , entry  :=  range  a .entries  {
176- 		if  err  :=  entry .Update (); err  !=  nil  {
182+ 		if  err  :=  entry .entry . Update (); err  !=  nil  {
177183			return  err 
178184		}
179185	}
0 commit comments