Last active
November 14, 2020 19:41
-
-
Save cyx/f89639025bc640fd7e8afbbd7b2e339b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
type Server struct { | |
Repo *Repository | |
Runtime *Runtime | |
} | |
func (s *Server) ExecuteCode(ctx context.Context, req *ExecuteRequest) (*ExecuteResponse, error) { | |
code, err := s.Repo.FetchCode(ctx, req.ID) | |
if err != nil { | |
return nil, err | |
} | |
res, err := s.Runtime.Execute(ctx, code) | |
if err != nil { | |
return nil, err | |
} | |
return &ExecuteResponse{Payload: res.Payload} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment