Open acelot opened 5 years ago
@vektah Any thoughts?
@acelot @vektah Any updates on this? Would be interested to use this method to pass arguments for pagination to the query for example
@acelot exported packages cannot contain the word "internal" in the path
Go is so "simple" and "straightforward" :laughing:
Yup, just got done testing this. Can confirm that this generated correctly. Thank you for turning me onto this.
package generated
import (
"sync"
"time"
"github.com/ddouglas/monocle"
)
// CorporationAllianceHistory2LoaderConfig captures the config to create a new CorporationAllianceHistory2Loader
type CorporationAllianceHistory2LoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []*monocle.DataloaderSort) ([][]*monocle.CorporationAllianceHistory, []error)
// Wait is how long wait before sending a batch
Wait time.Duration
// MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit
MaxBatch int
}
Still not sure how realistic it is, but we shall give it a shot. At least the generated code is correct
Hi guys, i have the same issue, but in my case every thing is imported and MyStructLoaderConfig is ok, but seems that dataloaden use my struct as key for cache.
// lazily created cache cache map[models.QueryParams][]*models.MyModel
Is there any way to create a different cache key when I use the "generate" command?
Thanks
Im trying to generate dataloader that uses struct type as a key instead of primitive type. Im using
gqlgen
and all my models are generated automatically. My project structure:Contents of
loaderkey.go
:Command to generate dataloader:
Dataloaded succesfully generates
authorloader_gen.go
dataloader. But there is a problem:As you can see fetch func using my
LoaderKey
type, but package is not imported. How to fix this?