@@ -239,7 +239,7 @@ func (d *DataAccessService) GetValidatorDashboardClDeposits(ctx context.Context,
239239 }
240240
241241 // Custom type for block_index
242- var data [] struct {
242+ type dbResult struct {
243243 GroupId sql.NullInt64 `db:"group_id"`
244244 PublicKey []byte `db:"publickey"`
245245 Slot int64 `db:"block_slot"`
@@ -333,28 +333,22 @@ func (d *DataAccessService) GetValidatorDashboardClDeposits(ctx context.Context,
333333 }
334334
335335 defaultColumns := []t.SortColumn {
336- {Column : goqu .I ("block_slot" ), Desc : true , Offset : currentCursor .Slot },
337- {Column : goqu .I ("block_index" ), Desc : true , Offset : currentCursor .SlotIndex },
336+ {Column : goqu .I ("bd. block_slot" ), Desc : true , Offset : currentCursor .Slot },
337+ {Column : goqu .I ("bd. block_index" ), Desc : true , Offset : currentCursor .SlotIndex },
338338 }
339339 order , directions , err := applySortAndPagination (defaultColumns , defaultColumns [0 ], currentCursor .GenericCursor )
340340 if err != nil {
341341 return nil , nil , err
342342 }
343343
344- depositsDs = depositsDs .
344+ depositsDs = goqu . Dialect ( "postgres" ). From ( depositsDs . As ( "bd" )) .
345345 Order (order ... ).
346346 Limit (uint (limit + 1 ))
347347 if directions != nil {
348348 depositsDs = depositsDs .Where (directions )
349349 }
350350
351- query , params , err := depositsDs .Prepared (true ).ToSQL ()
352- if err != nil {
353- return nil , nil , fmt .Errorf ("failed to prepare SQL query: %w" , err )
354- }
355-
356- err = db .AlloyReader .SelectContext (ctx , & data , query , params ... )
357-
351+ data , err := runQueryRows [[]dbResult ](ctx , db .AlloyReader , depositsDs )
358352 if err != nil {
359353 return nil , nil , err
360354 }
0 commit comments