The great module madness continus, now with pointers.
the build was successful

This commit is contained in:
2019-05-17 11:51:23 +02:00
parent 7e3dc49635
commit 162ccf6bfb
26 changed files with 296 additions and 210 deletions
+5 -5
View File
@@ -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.