You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about using Ascend with CreateSortIndex. In the result duplicate entries are not output. Is there a way that these are returned?
In this case only one Alice is returned:
As of right now, no, SortedIndex does not support duplicate entries. If two or more entries share the key value, the most recently updated/created offset will be returned.
I have a question about using Ascend with CreateSortIndex. In the result duplicate entries are not output. Is there a way that these are returned?
In this case only one Alice is returned:
package main
import (
"github.com/kelindar/column"
)
func main() {
// Erstellen einer neuen Tabelle
table := column.NewCollection()
table.CreateColumn("name", column.ForString())
table.CreateColumn("age", column.ForInt())
table.CreateColumn("country", column.ForString())
table.Insert(func(r column.Row) error {
r.SetString("name", "Charlie")
r.SetInt("age", 20)
r.SetString("country", "Großbritannien")
return nil
})
table.Insert(func(r column.Row) error {
r.SetString("name", "Alice")
r.SetInt("age", 25)
r.SetString("country", "USA")
return nil
})
table.Insert(func(r column.Row) error {
r.SetString("name", "Alice")
r.SetInt("age", 34)
r.SetString("country", "Österreich")
return nil
})
table.Insert(func(r column.Row) error {
r.SetString("name", "Bob")
r.SetInt("age", 30)
r.SetString("country", "Kanada")
return nil
})
table.Insert(func(r column.Row) error {
r.SetString("name", "David")
r.SetInt("age", 35)
r.SetString("country", "Australien")
return nil
})
table.CreateSortIndex("index1", "name")
table.Query(func(txn *column.Txn) error {
name := txn.String("name")
age := txn.Int("age")
country := txn.String("country")
return txn.With("name").Ascend("index1", func(idx uint32) {
print("idx: ", idx)
valueName, _ := name.Get()
print(" name: ", valueName)
valueAge, _ := age.Get()
print(" age: ", valueAge)
valueCountry, _ := country.Get()
println(" contry: ", valueCountry)
})
})
}
The text was updated successfully, but these errors were encountered: