Documentation ¶
Overview ¶
Package columnsorter performs toposort of column names. It is used to compute the exhausitve list of columns in a table, when not all the row may have the same set of columns.
Thread compatible.
Legal call sequence: New AddColumns* Sort (Columns|Index)*
Example ¶
package main import ( "fmt" "github.com/grailbio/gql/columnsorter" "github.com/grailbio/gql/symbol" ) func main() { s := columnsorter.New() s.AddColumns([]symbol.ID{10, 11, 12}) s.AddColumns([]symbol.ID{12, 13}) s.AddColumns([]symbol.ID{11, 20, 12}) s.Sort() fmt.Println(s.Columns()) fmt.Println(s.Index(20)) }
Output: [10 11 20 12 13] 2
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
T is the main sorter object. Use New() to create the sorter.
func (*T) AddColumns ¶
AddColumns adds a sorted list of columns that appear in a row. One column can appear multiple times across AddColumn calls.
REQUIRES: Sort has not been called
Click to show internal directories.
Click to hide internal directories.