You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
482 B
32 lines
482 B
package data |
|
|
|
import "errors" |
|
|
|
// 状态枚举 |
|
type Status int32 |
|
|
|
const ( |
|
StatusDisabled Status = 0 |
|
StatusOk Status = 1 |
|
StatusProcessing Status = 2 |
|
StatusDeleted Status = 4 |
|
StatusFailed Status = 5 |
|
) |
|
|
|
var ( |
|
ErrorNotExists = errors.New("not exists") |
|
) |
|
|
|
func PageCalc(page, size int) (offset, limit int) { |
|
if page <= 0 { |
|
page = 1 |
|
} |
|
switch { |
|
case size > 1000: |
|
size = 1000 |
|
case size <= 0: |
|
size = 20 |
|
} |
|
offset = (page - 1) * size |
|
return offset, size |
|
}
|
|
|