Skip to content

Duplicate index entries #86

@roihe

Description

@roihe

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)
})
})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions