package resolvers import ( "context" "errors" "git.aiterp.net/rpdata/api/models" "git.aiterp.net/rpdata/api/models/changes" ) /// Queries func (r *queryResolver) Changes(ctx context.Context, filter *changes.Filter) ([]*models.Change, error) { changes, err := changes.List(filter) if err != nil { return nil, err } changes2 := make([]*models.Change, len(changes)) for i := range changes { changes2[i] = &changes[i] } return changes2, nil } /// Subscriptions func (r *subscriptionResolver) Changes(ctx context.Context, keys []*models.ChangeKey) (<-chan *models.Change, error) { if len(keys) == 0 { return nil, errors.New("At least one key is required for a subscription") } keys2 := make([]models.ChangeKey, len(keys)) for i := range keys { keys2[i] = *keys[i] } return changes.Subscribe(ctx, keys2, false), nil }