2019-01-19 18:01:06 +03:00
|
|
|
package resolvers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-06-21 23:12:04 +03:00
|
|
|
"github.com/MichaelMure/git-bug/api/graphql/graph"
|
|
|
|
"github.com/MichaelMure/git-bug/api/graphql/models"
|
2019-01-19 18:01:06 +03:00
|
|
|
)
|
|
|
|
|
2019-03-31 22:44:14 +03:00
|
|
|
var _ graph.IdentityResolver = &identityResolver{}
|
|
|
|
|
2019-01-19 18:01:06 +03:00
|
|
|
type identityResolver struct{}
|
|
|
|
|
2020-02-03 23:03:48 +03:00
|
|
|
func (identityResolver) ID(ctx context.Context, obj models.IdentityWrapper) (string, error) {
|
2020-02-06 01:42:49 +03:00
|
|
|
return obj.Id().String(), nil
|
2019-02-19 02:10:40 +03:00
|
|
|
}
|
2020-02-08 19:22:45 +03:00
|
|
|
|
2020-02-03 23:03:48 +03:00
|
|
|
func (r identityResolver) HumanID(ctx context.Context, obj models.IdentityWrapper) (string, error) {
|
2020-02-08 19:22:45 +03:00
|
|
|
return obj.Id().Human(), nil
|
|
|
|
|
|
|
|
}
|