Closed irr123 closed 3 years ago
Hello, maybe I dont undestand how it works but, I prepare an example, which completely confuses me. Here is the code:
package main import ( "fmt" "github.com/kelindar/column" ) func main() { str() fmt.Println() int() } func str() { coll := column.NewCollection() coll.CreateColumn("id", column.ForInt64()) coll.CreateColumn("data", column.ForString()) coll.CreateIndex("1", "id", func(r column.Reader) bool { return r.Int() == 1 }) dd := []string{"aaa", "bbb", "ccc", "ddd"} for i, d := range dd { coll.Insert(map[string]interface{}{"id": i, "data": d}) } coll.Query(func(tx *column.Txn) error { tx.With("1").Select(func(v column.Selector) { fmt.Printf("%v: %v\n", v.ValueAt("id"), v.ValueAt("data")) }) return nil }) } func int() { coll := column.NewCollection() coll.CreateColumn("id", column.ForInt64()) coll.CreateColumn("data", column.ForInt64()) coll.CreateIndex("1", "id", func(r column.Reader) bool { return r.Int() == 1 }) dd := []int64{100, 200, 300, 400} for i, d := range dd { coll.Insert(map[string]interface{}{"id": i, "data": d}) } coll.Query(func(tx *column.Txn) error { tx.With("1").Select(func(v column.Selector) { fmt.Printf("%v: %v\n", v.ValueAt("id"), v.ValueAt("data")) }) return nil }) }
and an output, which is the same on both apple silicon and apple intel macs:
0: ddd 1: ddd 2: ddd 3: ddd 0: 100 1: 200 2: 300 3: 400
So, which behaviour confused me, in str-func, I expect to see output:
str
1: bbb
similarly, in intI expect something like:
int
1: 200
But same code works different for different data types and, as I think, not solve problem to get values by index.
@irr123 both are bugs, was able to reproduce them and are going to fix them soon
Hello, maybe I dont undestand how it works but, I prepare an example, which completely confuses me. Here is the code:
and an output, which is the same on both apple silicon and apple intel macs:
So, which behaviour confused me, in
str
-func, I expect to see output:similarly, in
int
I expect something like:But same code works different for different data types and, as I think, not solve problem to get values by index.