vektah / dataloaden

go generate based DataLoader
MIT License
528 stars 79 forks source link

Generation removes config #27

Closed surkova closed 5 years ago

surkova commented 5 years ago

For some members of our team re-generation removes parts that have to do with config, for example:

// MediaLoaderConfig captures the config to create a new MediaLoader
type MediaLoaderConfig struct {
    // Fetch is a method that provides the data for the loader
    Fetch func(keys []uint64) ([]*graphql.Media, []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
}

// NewMediaLoader creates a new MediaLoader given a fetch, wait, and maxBatch
func NewMediaLoader(config MediaLoaderConfig) *MediaLoader {
    return &MediaLoader{
        fetch:    config.Fetch,
        wait:     config.Wait,
        maxBatch: config.MaxBatch,
    }
}

Do you have any idea why this might be happening?