service backend
This commit is contained in:
10
api/ledger/internal/model/util.go
Normal file
10
api/ledger/internal/model/util.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package ledger
|
||||
|
||||
// dstSlice returns dst[:n] if capacity is enough, otherwise a new slice with capHint capacity.
|
||||
// Avoids fmt/errors; tiny helper for in-place reuse when recomputing CurrentOwners.
|
||||
func dstSlice[T any](dst []T, n, capHint int) []T {
|
||||
if cap(dst) >= capHint {
|
||||
return dst[:n]
|
||||
}
|
||||
return make([]T, n, capHint)
|
||||
}
|
||||
Reference in New Issue
Block a user