github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/column_mapping_test.go (about) 1 package parquet_test 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/segmentio/parquet-go" 8 ) 9 10 func ExampleSchema_Lookup() { 11 schema := parquet.SchemaOf(struct { 12 FirstName string `parquet:"first_name"` 13 LastName string `parquet:"last_name"` 14 Attributes []struct { 15 Name string `parquet:"name"` 16 Value string `parquet:"value"` 17 } `parquet:"attributes"` 18 }{}) 19 20 for _, path := range schema.Columns() { 21 leaf, _ := schema.Lookup(path...) 22 fmt.Printf("%d => %q\n", leaf.ColumnIndex, strings.Join(path, ".")) 23 } 24 25 // Output: 26 // 0 => "first_name" 27 // 1 => "last_name" 28 // 2 => "attributes.name" 29 // 3 => "attributes.value" 30 }