feat: allow to fetch nodes

This commit is contained in:
Alexander Navarro 2024-11-22 21:05:15 -03:00
parent 3cf643c83d
commit 8af94161ab
8 changed files with 141 additions and 30 deletions

View file

@ -23,7 +23,7 @@ type PlatformClass interface {
// the node's functionality is available.
type Platform struct {
Node // Underlaying node info
collections []*Collection // Child nodes
Collections []*Collection // Child nodes
}
type Fetcher = func(pagination Pagination) ([]*Collection, Pagination, error)
@ -47,13 +47,13 @@ func (platform *Platform) FetchCollections(fetcher Fetcher, start_pagination Pag
if err != nil {
return err
}
platform.collections = slices.Concat(platform.collections, collections)
platform.Collections = slices.Concat(platform.Collections, collections)
if pagination.HasMore {
return platform.FetchCollections(fetcher, pagination)
}
err = BulkCreateNode(platform._conn, platform.collections)
err = BulkCreateNode(platform._conn, platform.Collections)
return nil
}