Renamed OnPerson to OnActor
This commit is contained in:
parent
b8b0448aff
commit
48db6d24ad
2 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ type withObjectFn func (*Object) error
|
||||||
type withActivityFn func (*Activity) error
|
type withActivityFn func (*Activity) error
|
||||||
type withIntransitiveActivityFn func (*IntransitiveActivity) error
|
type withIntransitiveActivityFn func (*IntransitiveActivity) error
|
||||||
type withQuestionFn func (*Question) error
|
type withQuestionFn func (*Question) error
|
||||||
type withPersonFn func (*Person) error
|
type withActorFn func (*Actor) error
|
||||||
type withCollectionInterfaceFn func (collection CollectionInterface) error
|
type withCollectionInterfaceFn func (collection CollectionInterface) error
|
||||||
type withCollectionFn func (collection *Collection) error
|
type withCollectionFn func (collection *Collection) error
|
||||||
type withCollectionPageFn func (*CollectionPage) error
|
type withCollectionPageFn func (*CollectionPage) error
|
||||||
|
@ -28,7 +28,7 @@ func OnObject(it Item, fn withObjectFn) error {
|
||||||
return fn(ob)
|
return fn(ob)
|
||||||
})
|
})
|
||||||
} else if ActorTypes.Contains(it.GetType()) {
|
} else if ActorTypes.Contains(it.GetType()) {
|
||||||
return OnPerson(it, func(p *Person) error {
|
return OnActor(it, func(p *Actor) error {
|
||||||
ob, err := ToObject(p)
|
ob, err := ToObject(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -93,8 +93,8 @@ func OnQuestion(it Item, fn withQuestionFn) error {
|
||||||
return fn(act)
|
return fn(act)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnPerson
|
// OnActor
|
||||||
func OnPerson(it Item, fn withPersonFn) error {
|
func OnActor(it Item, fn withActorFn) error {
|
||||||
if !ActorTypes.Contains(it.GetType()) {
|
if !ActorTypes.Contains(it.GetType()) {
|
||||||
return errors.New(fmt.Sprintf("%T[%s] can't be converted to Person", it, it.GetType()))
|
return errors.New(fmt.Sprintf("%T[%s] can't be converted to Person", it, it.GetType()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ func TestOnQuestion(t *testing.T) {
|
||||||
|
|
||||||
func TestOnPerson(t *testing.T) {
|
func TestOnPerson(t *testing.T) {
|
||||||
pers := PersonNew("testPerson")
|
pers := PersonNew("testPerson")
|
||||||
err := OnPerson(pers, func(a *Person) error {
|
err := OnActor(pers, func(a *Person) error {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ func TestOnPerson(t *testing.T) {
|
||||||
t.Errorf("Unexpected error returned %s", err)
|
t.Errorf("Unexpected error returned %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = OnPerson(pers, func(p *Person) error {
|
err = OnActor(pers, func(p *Person) error {
|
||||||
if p.Type != pers.Type {
|
if p.Type != pers.Type {
|
||||||
t.Errorf("In function type %s different than expected, %s", p.Type, pers.Type)
|
t.Errorf("In function type %s different than expected, %s", p.Type, pers.Type)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue