Created
May 20, 2020 10:34
-
-
Save RicardoLinck/0201f2b787f16a005eeb0a997b2b39a3 to your computer and use it in GitHub Desktop.
Query used in other examples
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 main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"time" | |
) | |
func executeQuery(url string) string { | |
start := time.Now() | |
response, _ := http.Get(url) | |
defer response.Body.Close() | |
body, _ := ioutil.ReadAll(response.Body) | |
fmt.Printf("Request time: %d ms from url%s\n", time.Since(start).Nanoseconds()/time.Millisecond.Nanoseconds(), url) | |
return fmt.Sprintf("%s from %s", body, url) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment