bump go-structr to v0.8.9 (returns early if zero uncached keys to be loaded)

This commit is contained in:
kim 2024-09-12 18:24:24 +01:00
commit 83d8b0680a
6 changed files with 11 additions and 5 deletions

View file

@ -375,6 +375,11 @@ func (c *Cache[T]) Load(index *Index, keys []Key, load func([]Key) ([]T, error))
// the lock.
unlock()
if len(keys) == 0 {
// We loaded everything!
return values, nil
}
// Load uncached values.
uncached, err := load(keys)
if err != nil {

View file

@ -41,7 +41,6 @@ func free_indexed_item(item *indexed_item) {
}
// drop_index will drop the given index entry from item's indexed.
// note this also handles freeing the index_entry memory (e.g. to pool)
func (i *indexed_item) drop_index(entry *index_entry) {
for x := 0; x < len(i.indexed); x++ {
if i.indexed[x] != entry {

View file

@ -152,8 +152,10 @@ func extract_fields(ptr unsafe.Pointer, fields []struct_field) []unsafe.Pointer
fptr = field.zero
}
// Set field ptr.
ptrs[i] = fptr
}
return ptrs
}