mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-13 08:43:03 +03:00
fix: empty lists don't get returned correctly from the api
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
|||||||
|
|
||||||
// MapStructList maps a list of source structs to a list of destination structs
|
// MapStructList maps a list of source structs to a list of destination structs
|
||||||
func MapStructList[S any, D any](source []S, destination *[]D) error {
|
func MapStructList[S any, D any](source []S, destination *[]D) error {
|
||||||
|
*destination = make([]D, 0, len(source))
|
||||||
|
|
||||||
for _, item := range source {
|
for _, item := range source {
|
||||||
var destItem D
|
var destItem D
|
||||||
if err := MapStruct(item, &destItem); err != nil {
|
if err := MapStruct(item, &destItem); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user