Пример #1
0
func TestInitSchema(t *testing.T) {
	data, _ := testutil.Asset("assets/origins.csv")

	iter := origins.NewCSVReader(bytes.NewBuffer(data))

	schema := Init("origins.attrs", iter)

	attrs := schema.Attrs()

	assert.Equal(t, 18, len(attrs))
}
Пример #2
0
func setup() storage.Engine {
	engine, _ := origins.Init("memory", nil)

	data, _ := testutil.Asset("assets/origins.csv")

	iter := origins.NewCSVReader(bytes.NewBuffer(data))

	tx, _ := transactor.New(engine, transactor.Options{})

	// Write the facts.
	if _, err := origins.Copy(iter, tx); err != nil {
		panic(err)
	}

	tx.Commit()

	return engine
}