GraphQL API and utilities for the rpdata project
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.

22 lines
555 B

  1. package queries
  2. import (
  3. "context"
  4. "errors"
  5. "git.aiterp.net/rpdata/api/model/character"
  6. )
  7. func (r *resolver) Character(ctx context.Context, id *string, nick *string) (character.Character, error) {
  8. if id != nil {
  9. return character.FindID(*id)
  10. } else if nick != nil {
  11. return character.FindNick(*nick)
  12. } else {
  13. return character.Character{}, errors.New("You must specify either an ID or a nick")
  14. }
  15. }
  16. func (r *resolver) Characters(ctx context.Context, filter *character.Filter) ([]character.Character, error) {
  17. return character.List(filter)
  18. }