Exemple #1
0
// writeResult writes the result of an oracle query to w in the specified
// format, "json" or "plain".
func writeResult(w io.Writer, res *oracle.Result, format string) {
	if format == "json" {
		b, err := json.Marshal(res.Serial())
		if err != nil {
			io.WriteString(w, err.Error())
			return
		}
		w.Write(b)
		return
	}
	res.WriteTo(w)
}