Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5528c264d3 |
@@ -274,6 +274,10 @@ func (c *Collection[T]) delete(tx *Snapshot, itemID uint64) error {
|
|||||||
return c.deleteItem(tx, itemID)
|
return c.deleteItem(tx, itemID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Collection[T]) Count(tx *Snapshot) int {
|
||||||
|
return c.ByID.Count(tx)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Collection[T]) getByID(tx *Snapshot, itemID uint64) (*T, bool) {
|
func (c *Collection[T]) getByID(tx *Snapshot, itemID uint64) (*T, bool) {
|
||||||
x := new(T)
|
x := new(T)
|
||||||
c.setID(x, itemID)
|
c.setID(x, itemID)
|
||||||
|
@@ -192,6 +192,11 @@ func (i *Index[T]) List(tx *Snapshot, args *ListArgs[T], out []*T) []*T {
|
|||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Index[T]) Count(tx *Snapshot) int {
|
||||||
|
tx = i.ensureSnapshot(tx)
|
||||||
|
return i.btree(tx).Len()
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
func (i *Index[T]) insertConflict(tx *Snapshot, item *T) bool {
|
func (i *Index[T]) insertConflict(tx *Snapshot, item *T) bool {
|
||||||
|
Reference in New Issue
Block a user