This file contains 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 ( | |
"testing" | |
) | |
func BenchmarkMovieRead(b *testing.B) { | |
for n := 0; n < b.N; n++ { | |
readJSON("movie.json", func(data map[string]interface{}) bool { | |
return data["year"].(float64) >= 2010 |
This file contains 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 ( | |
"encoding/json" | |
"os" | |
) | |
func readJSONToken(fileName string, filter func(map[string]interface{}) bool) []map[string]interface{} { | |
file, _ := os.Open(fileName) | |
defer file.Close() |
This file contains 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 ( | |
"encoding/json" | |
"io/ioutil" | |
) | |
func readJSON(fileName string, filter func(map[string]interface{}) bool) []map[string]interface{} { | |
datas := []map[string]interface{}{} |
This file contains 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 ( | |
"encoding/json" | |
"io/ioutil" | |
) | |
func readJSON(fileName string, filter func(map[string]interface{}) bool) []map[string]interface{} { | |
datas := []map[string]interface{}{} |