You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
661 B
29 lines
661 B
package types
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"git.aiterp.net/rpdata/api/graph2/graphcore"
|
|
"git.aiterp.net/rpdata/api/models"
|
|
)
|
|
|
|
type changeResolver struct{}
|
|
|
|
func (r *changeResolver) Objects(ctx context.Context, obj *models.Change) ([]graphcore.ChangeObject, error) {
|
|
objects := obj.Objects()
|
|
|
|
results := make([]graphcore.ChangeObject, 0, len(objects))
|
|
for _, object := range objects {
|
|
if changeObject, ok := object.(graphcore.ChangeObject); ok {
|
|
results = append(results, changeObject)
|
|
} else {
|
|
log.Printf("Type %T needs ChangeObject impl", object)
|
|
}
|
|
}
|
|
|
|
return results, nil
|
|
}
|
|
|
|
// ChangeResolver is a resolver
|
|
var ChangeResolver changeResolver
|