@@ -123,8 +123,8 @@ type AggregateQuery struct {
123123	Max            int 
124124	WithSchema     bool 
125125	Verbatim       bool 
126- 	WithCursor  bool 
127- 	Cursor      * Cursor 
126+ 	WithCursor      bool 
127+ 	Cursor          * Cursor 
128128	// TODO: add load fields 
129129
130130}
@@ -187,12 +187,12 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery {
187187}
188188
189189//Load document fields from the document HASH objects (if they are not in the sortables) 
190- func  (a  * AggregateQuery ) Load (  Properties  []string ) * AggregateQuery  {
190+ func  (a  * AggregateQuery ) Load (Properties  []string ) * AggregateQuery  {
191191	nproperties  :=  len (Properties )
192192	if  nproperties  >  0  {
193193		a .AggregatePlan  =  a .AggregatePlan .Add ("LOAD" , nproperties )
194194		for  _ , property  :=  range  Properties  {
195- 			a .AggregatePlan  =  a .AggregatePlan .Add (fmt .Sprintf (  "@%s" , property   ))
195+ 			a .AggregatePlan  =  a .AggregatePlan .Add (fmt .Sprintf ("@%s" , property ))
196196		}
197197	}
198198	return  a 
@@ -260,6 +260,7 @@ func (q AggregateQuery) Serialize() redis.Args {
260260	return  args 
261261}
262262
263+ // Deprecated: Please use processAggReply() instead 
263264func  ProcessAggResponse (res  []interface {}) [][]string  {
264265	aggregateReply  :=  make ([][]string , len (res ), len (res ))
265266	for  i  :=  0 ; i  <  len (res ); i ++  {
@@ -273,6 +274,25 @@ func ProcessAggResponse(res []interface{}) [][]string {
273274	return  aggregateReply 
274275}
275276
277+ func  processAggReply (res  []interface {}) (total  int , aggregateReply  [][]string , err  error ) {
278+ 	aggregateReply  =  [][]string {}
279+ 	total  =  0 
280+ 	aggregate_results  :=  len (res ) -  1 
281+ 	if  aggregate_results  >  0  {
282+ 		total  =  aggregate_results 
283+ 		aggregateReply  =  make ([][]string , aggregate_results , aggregate_results )
284+ 		for  i  :=  0 ; i  <  aggregate_results ; i ++  {
285+ 			if  d , e  :=  redis .Strings (res [i + 1 ], nil ); e  ==  nil  {
286+ 				aggregateReply [i ] =  d 
287+ 			} else  {
288+ 				err  =  fmt .Errorf ("Error parsing Aggregate Reply: %v on reply position %d" , e , i )
289+ 				aggregateReply [i ] =  nil 
290+ 			}
291+ 		}
292+ 	}
293+ 	return 
294+ }
295+ 
276296func  ProcessAggResponseSS (res  []interface {}) [][]string  {
277297	var  lout  =  len (res )
278298	aggregateReply  :=  make ([][]string , lout , lout )
0 commit comments