package store import ( "strconv" "strings" ) // ParsePrefixPageCursor decodes opaque cursors for revision prefix pagination. func ParsePrefixPageCursor(cursor string) (afterID *int64, offset int, useOffset bool) { cursor = strings.TrimSpace(cursor) if cursor == "" { return nil, 0, false } if strings.HasPrefix(cursor, "o:") { n, err := strconv.Atoi(strings.TrimPrefix(cursor, "o:")) if err != nil || n < 0 { return nil, 0, false } return nil, n, true } if n, err := strconv.ParseInt(cursor, 10, 64); err == nil && n >= 0 { return &n, 0, false } return nil, 0, false } // FormatPrefixPageCursor encodes the keyset cursor (last row id or slice index). func FormatPrefixPageCursor(lastID int64) string { return strconv.FormatInt(lastID, 10) }