func (q *StatsQuery) Results() (response *StatsResponse, err error) {
	err = doQuery(q.baseURI, q.datapath, q.params, &response)
	return
}
Results or error returned by the server.
package enigma
import (
	"encoding/json"
	"errors"
	"io/ioutil"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)
const (
	root    = "https://api.enigma.io"  
	version = "v2"
)
const (
	pollingInterval = 10 * time.Second
	pollingTimeout  = 2 * time.Minute
)
type endpoint string
const (
	meta   endpoint = "meta"
	data   endpoint = "data"
	stats  endpoint = "stats"
	export endpoint = "export"
)
type Conjunction string
const (
	Or  Conjunction = "or"
	And Conjunction = "and"
)
type SortDirection string
const (
	Asc SortDirection = "+"
	Desc SortDirection = "-"
)
type Operation string
const (
	Sum       Operation = "sum"
	Avg       Operation = "avg"
	StdDev    Operation = "stddev"
	Variance  Operation = "variance"
	Max       Operation = "max"
	Min       Operation = "min"
	Frequency Operation = "frequency"
)
type query struct {
	baseURI  string
	datapath string
	params   url.Values
}
func buildURL(baseURI, datapath string, params url.Values) string {
	uri := baseURI + "/" + datapath
	if len(params) > 0 {
		uri += "?" + params.Encode()
	}
	return uri
}
func doQuery(baseURI, datapath string, params url.Values, response interface{}) (err error) {
	uri := buildURL(baseURI, datapath, params)
	resp, err := http.Get(uri)
	if err != nil {
		return
	}
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return
	}
	defer resp.Body.Close()
	if resp.StatusCode != 200 {
		var e map[string]interface{}
		if json.Unmarshal(body, &e) != nil {
			return errors.New(resp.Status)
		}
		return errors.New(e["info"].(map[string]interface{})["additional"].(string))
	}
	if err = json.Unmarshal(body, &response); err != nil {
		return
	}
	return
}
type MetaParentNodeResponse struct {
	DataPath string `json:"data_path"`
	Result   struct {
		Path []struct {
			Level       string `json:"level"`
			Label       string `json:"label"`
			Description string `json:"description"`
		} `json:"path"`
		ImmediateNodes []struct {
			Datapath    string `json:"datapath"`
			Label       string `json:"label"`
			Description string `json:"description"`
		} `json:"immediate_nodes"`
		ChildrenTables []struct {
			Datapath         string `json:"datapath"`
			Label            string `json:"label"`
			Description      string `json:"description"`
			DbBoundaryLabel  string `json:"db_boundary_label"`
			DbBoundaryTables string `json:"db_boundary_tables"`
		} `json:"children_tables"`
	} `json:"result"`
	Info struct {
		ResultType          string `json:"result_type"`
		ChildrenTablesLimit int    `json:"children_tables_limit"`
		ChildrenTablesTotal int    `json:"children_tables_total"`
		CurrentPage         int    `json:"current_page"`
		TotalPages          int    `json:"total_pages"`
	} `json:"info"`
}
type MetaTableNodeResponse struct {
	DataPath string `json:"datapath"`
	Result   struct {
		Path []struct {
			Level       string `json:"level"`
			Label       string `json:"label"`
			Description string `json:"description"`
		} `json:"path"`
		Columns []struct {
			ID          string `json:"id"`
			Label       string `json:"label"`
			Description string `json:"description"`
			Type        string `json:"type"`
			Index       int    `json:"index"`
		} `json:"columns"`
		DbBoundaryDatapath string `json:"db_boundary_datapath"`
		DbBoundaryLabel    string `json:"db_boundary_label"`
		DbBoundaryTables   []struct {
			Datapath string `json:"datapath"`
			Label    string `json:"label"`
		} `json:"db_boundary_tables"`
		AncestorDatapaths []string `json:"ancestor_datapaths"`
		Documents         []struct {
			URL   string `json:"url"`
			Title string `json:"title"`
			Type  string `json:"type"`
		} `json:"documents"`
		Metadata []struct {
			Value string `json:"value"`
			Label string `json:"label"`
		} `json:"metadata"`
	} `json:"result"`
	Info struct {
		ResultType string `json:"result_type"`
	} `json:"info"`
}
type MetaQuery query
func (q *MetaQuery) Parent(datapath string) (response *MetaParentNodeResponse, err error) {
	err = doQuery(q.baseURI, datapath, q.params, &response)
	return
}
func (q *MetaQuery) Table(datapath string) (response *MetaTableNodeResponse, err error) {
	err = doQuery(q.baseURI, datapath, q.params, &response)
	return
}
type StatsResponse struct {
	DataPath string          `json:"data_path"`
	Result   json.RawMessage `json:"result"`
	Info     struct {
		Column       interface{} `json:"column"`
		Operations   []Operation `json:"operations"`
		RowsLimit    int         `json:"rows_limit"`
		CurrentPage  int         `json:"current_page"`
		TotalPages   int         `json:"total_pages"`
		TotalResults int         `json:"total_results"`
	} `json:"info"`
}
type StatsQuery query
func (q *StatsQuery) selectColumn(column string) *StatsQuery {
	q.params.Add("select", column)
	return q
}
func (q *StatsQuery) Limit(limit int) *StatsQuery {
	q.params.Add("limit", strconv.Itoa(limit))
	return q
}
func (q *StatsQuery) Search(query string) *StatsQuery {
	q.params.Add("search", query)
	return q
}
func (q *StatsQuery) Where(query string) *StatsQuery {
	q.params.Add("where", query)
	return q
}
func (q *StatsQuery) Conjunction(conjunction Conjunction) *StatsQuery {
	q.params.Add("conjunction", string(conjunction))
	return q
}
func (q *StatsQuery) Operation(operation Operation) *StatsQuery {
	q.params.Add("operation", string(operation))
	return q
}
func (q *StatsQuery) By(operation Operation) *StatsQuery {
	q.params.Add("by", string(operation))
	return q
}
func (q *StatsQuery) Of(column string) *StatsQuery {
	q.params.Add("of", column)
	return q
}
func (q *StatsQuery) Sort(direction SortDirection) *StatsQuery {
	q.params.Add("sort", string(direction))
	return q
}
func (q *StatsQuery) Page(number int) *StatsQuery {
	q.params.Add("page", strconv.Itoa(number))
	return q
}