()
| 280 | } |
| 281 | |
| 282 | func (this *Table[T]) Count() (int64, error) { |
| 283 | var count int64 |
| 284 | |
| 285 | var begin = this.FullKeyBytes(nil) |
| 286 | it, err := this.db.store.rawDB.NewIter(&pebble.IterOptions{ |
| 287 | LowerBound: begin, |
| 288 | UpperBound: append(begin, 0xFF), |
| 289 | }) |
| 290 | if err != nil { |
| 291 | return 0, err |
| 292 | } |
| 293 | defer func() { |
| 294 | _ = it.Close() |
| 295 | }() |
| 296 | |
| 297 | for it.First(); it.Valid(); it.Next() { |
| 298 | count++ |
| 299 | } |
| 300 | |
| 301 | return count, err |
| 302 | } |
| 303 | |
| 304 | func (this *Table[T]) FullKey(realKey string) []byte { |
| 305 | return append(this.Namespace(), KeyPrefix+realKey...) |
nothing calls this directly
no test coverage detected