NumericPosition calculates a rough float position for progress tracking. Note: This method only uses the first 8 bytes of the binary key for progress calculation. This works well for timestamp-based keys like UUID v7 (where the first 48 bits are a timestamp), but progress may appear frozen when pro
()
| 140 | // |
| 141 | // The core pagination algorithm (using Compare()) is unaffected and works correctly with any binary data. |
| 142 | func (k BinaryKey) NumericPosition() float64 { |
| 143 | if len(k.Value) == 0 { |
| 144 | return 0.0 |
| 145 | } |
| 146 | |
| 147 | // Take up to the first 8 bytes to form a uint64 for estimation |
| 148 | var buf [8]byte |
| 149 | copy(buf[:], k.Value) |
| 150 | |
| 151 | val := binary.BigEndian.Uint64(buf[:]) |
| 152 | return float64(val) |
| 153 | } |
| 154 | |
| 155 | func (k BinaryKey) String() string { |
| 156 | return hex.EncodeToString(k.Value) |
no outgoing calls