gqlgen Squashed commit of the following: commit162ccf6bfbAuthor: Gisle Aune <dev@gisle.me> Date: Fri May 17 11:51:23 2019 +0200 The great module madness continus, now with pointers. commit7e3dc49635Author: Gisle Aune <dev@gisle.me> Date: Thu May 16 15:57:08 2019 +0200 Basic stuff, doesn't compile
This commit is contained in:
@@ -11,13 +11,13 @@ import (
|
||||
)
|
||||
|
||||
// Channel gets a character by key
|
||||
func (loader *Loader) Channel(key, value string) (models.Channel, error) {
|
||||
func (loader *Loader) Channel(key, value string) (*models.Channel, error) {
|
||||
if !strings.HasPrefix(key, "Channel.") {
|
||||
key = "Channel." + key
|
||||
}
|
||||
|
||||
if loader.loaders[key] == nil {
|
||||
return models.Channel{}, errors.New("unsupported key")
|
||||
return nil, errors.New("unsupported key")
|
||||
}
|
||||
|
||||
loader.loadPrimed(key)
|
||||
@@ -25,15 +25,15 @@ func (loader *Loader) Channel(key, value string) (models.Channel, error) {
|
||||
thunk := loader.loaders[key].Load(loader.ctx, dataloader.StringKey(value))
|
||||
res, err := thunk()
|
||||
if err != nil {
|
||||
return models.Channel{}, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
channel, ok := res.(models.Channel)
|
||||
if !ok {
|
||||
return channel, errors.New("incorrect type")
|
||||
return nil, errors.New("incorrect type")
|
||||
}
|
||||
|
||||
return channel, nil
|
||||
return &channel, nil
|
||||
}
|
||||
|
||||
// PrimeChannels primes channels for loading along with the first one.
|
||||
|
||||
Reference in New Issue
Block a user