Skip to content

Instantly share code, notes, and snippets.

@cyx
Last active November 14, 2020 19:41
Show Gist options
  • Save cyx/f89639025bc640fd7e8afbbd7b2e339b to your computer and use it in GitHub Desktop.
Save cyx/f89639025bc640fd7e8afbbd7b2e339b to your computer and use it in GitHub Desktop.
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