MCPcopy Index your code
hub / github.com/dreamsofcode-io/grpc / Read

Method Read

pokemon-api/pokedex/server.go:67–86  ·  view source on GitHub ↗
(
	ctx context.Context,
	req *pb.PokemonFilter,
)

Source from the content-addressed store, hash-verified

65}
66
67func (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
88func (s *Server) ReadOne(
89 ctx context.Context,

Callers

nothing calls this directly

Calls 2

pokemonToResponseFunction · 0.85
FindAllMethod · 0.80

Tested by

no test coverage detected