Начало реализации сервиса.

This commit is contained in:
Grbisba
2026-10-30 12:25:56 +03:00
parent 65003b6119
commit 20f2f00a60
52 changed files with 4351 additions and 1 deletions
@@ -0,0 +1,28 @@
package inmemory
import (
"bytes"
"time"
"github.com/google/uuid"
"gitea.privcloud.tech/mtusi2026/internal/pkg/apperr"
)
func pageLimit(rawLimit *int) (int, error) {
limit := 50
if rawLimit != nil {
limit = *rawLimit
}
if limit < 1 || limit > 100 {
return 0, apperr.New(apperr.CodeInvalidRequest, "invalid limit")
}
return limit, nil
}
func lessKey(leftTime time.Time, leftID uuid.UUID, rightTime time.Time, rightID uuid.UUID) bool {
if !leftTime.Equal(rightTime) {
return leftTime.Before(rightTime)
}
return bytes.Compare(leftID[:], rightID[:]) < 0
}