From 3015624baf4f280a1b6812b39ddb1c2506ccd4a7 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Wed, 6 Feb 2019 15:50:21 +1100 Subject: [PATCH] Regen dataloader with correct version --- example/dataloader/addressloader_gen.go | 23 +++++++++++++++++++++- example/dataloader/itemsliceloader_gen.go | 23 +++++++++++++++++++++- example/dataloader/ordersliceloader_gen.go | 23 +++++++++++++++++++++- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/example/dataloader/addressloader_gen.go b/example/dataloader/addressloader_gen.go index 0465446faa7..90e1d433fc5 100644 --- a/example/dataloader/addressloader_gen.go +++ b/example/dataloader/addressloader_gen.go @@ -1,4 +1,4 @@ -// generated by github.com/vektah/dataloaden ; DO NOT EDIT +// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. package dataloader @@ -7,6 +7,27 @@ import ( "time" ) +// AddressLoaderConfig captures the config to create a new AddressLoader +type AddressLoaderConfig struct { + // Fetch is a method that provides the data for the loader + Fetch func(keys []int) ([]*Address, []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 +} + +// NewAddressLoader creates a new AddressLoader given a fetch, wait, and maxBatch +func NewAddressLoader(config AddressLoaderConfig) *AddressLoader { + return &AddressLoader{ + fetch: config.Fetch, + wait: config.Wait, + maxBatch: config.MaxBatch, + } +} + // AddressLoader batches and caches requests type AddressLoader struct { // this method provides the data for the loader diff --git a/example/dataloader/itemsliceloader_gen.go b/example/dataloader/itemsliceloader_gen.go index 55f21b4cae5..5fa10078401 100644 --- a/example/dataloader/itemsliceloader_gen.go +++ b/example/dataloader/itemsliceloader_gen.go @@ -1,4 +1,4 @@ -// generated by github.com/vektah/dataloaden ; DO NOT EDIT +// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. package dataloader @@ -7,6 +7,27 @@ import ( "time" ) +// ItemSliceLoaderConfig captures the config to create a new ItemSliceLoader +type ItemSliceLoaderConfig struct { + // Fetch is a method that provides the data for the loader + Fetch func(keys []int) ([][]Item, []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 +} + +// NewItemSliceLoader creates a new ItemSliceLoader given a fetch, wait, and maxBatch +func NewItemSliceLoader(config ItemSliceLoaderConfig) *ItemSliceLoader { + return &ItemSliceLoader{ + fetch: config.Fetch, + wait: config.Wait, + maxBatch: config.MaxBatch, + } +} + // ItemSliceLoader batches and caches requests type ItemSliceLoader struct { // this method provides the data for the loader diff --git a/example/dataloader/ordersliceloader_gen.go b/example/dataloader/ordersliceloader_gen.go index 6b168ec1fb4..e76e24d31f0 100644 --- a/example/dataloader/ordersliceloader_gen.go +++ b/example/dataloader/ordersliceloader_gen.go @@ -1,4 +1,4 @@ -// generated by github.com/vektah/dataloaden ; DO NOT EDIT +// Code generated by github.com/vektah/dataloaden, DO NOT EDIT. package dataloader @@ -7,6 +7,27 @@ import ( "time" ) +// OrderSliceLoaderConfig captures the config to create a new OrderSliceLoader +type OrderSliceLoaderConfig struct { + // Fetch is a method that provides the data for the loader + Fetch func(keys []int) ([][]Order, []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 +} + +// NewOrderSliceLoader creates a new OrderSliceLoader given a fetch, wait, and maxBatch +func NewOrderSliceLoader(config OrderSliceLoaderConfig) *OrderSliceLoader { + return &OrderSliceLoader{ + fetch: config.Fetch, + wait: config.Wait, + maxBatch: config.MaxBatch, + } +} + // OrderSliceLoader batches and caches requests type OrderSliceLoader struct { // this method provides the data for the loader