(pf *pq.File, s string)
| 7 | ) |
| 8 | |
| 9 | func GetColumnIndexByPath(pf *pq.File, s string) (index, depth, maxDef int) { |
| 10 | colSelector := strings.Split(s, ".") |
| 11 | n := pf.Root() |
| 12 | for len(colSelector) > 0 { |
| 13 | n = n.Column(colSelector[0]) |
| 14 | if n == nil { |
| 15 | return -1, -1, -1 |
| 16 | } |
| 17 | |
| 18 | colSelector = colSelector[1:] |
| 19 | depth++ |
| 20 | } |
| 21 | |
| 22 | return n.Index(), depth, n.MaxDefinitionLevel() |
| 23 | } |
| 24 | |
| 25 | func HasColumn(pf *pq.File, s string) bool { |
| 26 | index, _, _ := GetColumnIndexByPath(pf, s) |
no outgoing calls