( ctx context.Context, req *pb.PokemonFilter, )
| 65 | } |
| 66 | |
| 67 | func (s *Server) Read( |
| 68 | ctx context.Context, |
| 69 | req *pb.PokemonFilter, |
| 70 | ) (*pb.PokemonListResponse, error) { |
| 71 | pokemon, err := s.repository.FindAll(ctx) |
| 72 | if err != nil { |
| 73 | return nil, fmt.Errorf("failed to find all pokemon: %w", err) |
| 74 | } |
| 75 | |
| 76 | res := make([]*pb.Pokemon, len(pokemon)) |
| 77 | |
| 78 | for i, pokemon := range pokemon { |
| 79 | p := pokemonToResponse(pokemon) |
| 80 | res[i] = &p |
| 81 | } |
| 82 | |
| 83 | return &pb.PokemonListResponse{ |
| 84 | Pokemon: res, |
| 85 | }, nil |
| 86 | } |
| 87 | |
| 88 | func (s *Server) ReadOne( |
| 89 | ctx context.Context, |
nothing calls this directly
no test coverage detected