feat: add list of currencies
This commit is contained in:
@@ -31,7 +31,11 @@ func Paginate[T any](langID uint, paging Paging, stmt *gorm.DB) (Found[T], error
|
||||
var items []T
|
||||
var count int64
|
||||
|
||||
stmt.Count(&count)
|
||||
countStmt := stmt.Session(&gorm.Session{}).Select("count(*)").Offset(-1).Limit(-1)
|
||||
|
||||
if err := countStmt.Count(&count).Error; err != nil {
|
||||
return Found[T]{}, err
|
||||
}
|
||||
|
||||
err := stmt.
|
||||
Offset(paging.Offset()).
|
||||
@@ -42,15 +46,10 @@ func Paginate[T any](langID uint, paging Paging, stmt *gorm.DB) (Found[T], error
|
||||
return Found[T]{}, err
|
||||
}
|
||||
|
||||
// columnsSpec := GetColumnsSpec[T](langID)
|
||||
|
||||
return Found[T]{
|
||||
Items: items,
|
||||
Count: uint(count),
|
||||
// Spec: map[string]interface{}{
|
||||
// "columns": columnsSpec,
|
||||
// },
|
||||
}, err
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetColumnsSpec[T any] generates a column specification map for a given struct type T.
|
||||
|
||||
Reference in New Issue
Block a user