Migrated rpdata-api to using go modules and a more recent version of
the build was successful

gqlgen

Squashed commit of the following:

commit 162ccf6bfb
Author: Gisle Aune <dev@gisle.me>
Date:   Fri May 17 11:51:23 2019 +0200

    The great module madness continus, now with pointers.

commit 7e3dc49635
Author: Gisle Aune <dev@gisle.me>
Date:   Thu May 16 15:57:08 2019 +0200

    Basic stuff, doesn't compile
This commit is contained in:
2019-05-17 12:20:08 +02:00
parent aff0d99842
commit e794311eb8
31 changed files with 424 additions and 511 deletions
+7 -5
View File
@@ -12,13 +12,13 @@ var subList []*subscription
type subscription struct {
Keys map[string]bool
Channel chan<- models.Change
Channel chan<- *models.Change
WildCard bool
}
// Subscribe subscribes to all changes.
func Subscribe(ctx context.Context, keys []models.ChangeKey, wildcard bool) <-chan models.Change {
channel := make(chan models.Change, 64)
func Subscribe(ctx context.Context, keys []models.ChangeKey, wildcard bool) <-chan *models.Change {
channel := make(chan *models.Change, 64)
sub := &subscription{
Keys: make(map[string]bool, len(keys)),
Channel: channel,
@@ -58,16 +58,18 @@ func pushToSubscribers(change models.Change) {
subMutex.Lock()
SubLoop:
for _, sub := range subList {
changeCopy := change
if sub.WildCard && change.Listed {
select {
case sub.Channel <- change:
case sub.Channel <- &changeCopy:
default:
}
} else {
for _, key := range keys {
if sub.Keys[key] {
select {
case sub.Channel <- change:
case sub.Channel <- &changeCopy:
default:
}