P0 fixes: - ModelError.Is(): use exact matching instead of substring contains() - shouldClearStickySession: add context param for cancellation/tracing P1 fixes: - TODO stubs: return 501 Not Implemented errors - validateInstanceSignature: deduplicate to shared validateCodeSignature() - Error messages: standardize to English only - http.go: remove pseudo if-else with duplicate branches
17 lines
414 B
Go
17 lines
414 B
Go
package repository
|
|
|
|
import "github.com/Wei-Shaw/sub2api/internal/pkg/pagination"
|
|
|
|
func paginationResultFromTotal(total int64, params pagination.PaginationParams) *pagination.PaginationResult {
|
|
pages := int(total) / params.Limit()
|
|
if int(total)%params.Limit() > 0 {
|
|
pages++
|
|
}
|
|
return &pagination.PaginationResult{
|
|
Total: total,
|
|
Page: params.Page,
|
|
PageSize: params.Limit(),
|
|
Pages: pages,
|
|
}
|
|
}
|