Exemplo n.º 1
0
func init() {
	var dat []interface{}
	for i := 0; i < 1000*1000; i++ {
		dat = append(dat, i)
	}
	bigDF, _ = data.NewFrame([]string{"first"}, [][]interface{}{
		dat,
	})
}
Exemplo n.º 2
0
	for _, tc := range []struct {
		s string
		v *data.Vector
	}{
		{"a", data.NewVector(1, 2, 3)},
		{"b", data.NewVector("x", "y", "z")},
		{"c", data.NewVector(10.1, 11.2, 12.3)},
		{"d", dt},
	} {
		if !reflect.DeepEqual(df.Column(tc.s), tc.v) {
			t.Errorf("Not equal: %s and %s", tc.s, tc.v)
		}
	}
}

var simpleDF, _ = data.NewFrame([]string{"first"}, [][]interface{}{{1, 2, 3}})

// We create a fictios driver to test cache auto-refresh properties, which always returns
// df.
type countDB struct {
	m  map[string]int // Count number of queires
	df *data.Frame    // Frame to return
}

// DB interface implementation
func (c *countDB) Name() string   { return "countDB" }
func (c *countDB) Driver() string { return "countDB" }
func (c *countDB) Query(sql string) (*data.Frame, error) {
	c.m[sql] = c.m[sql] + 1
	return c.df, nil
}