possibleKeyAt returns a variant key at given index within the all possible key combinations for v, or nil if index is out of range.
(index int)
| 344 | // possibleKeyAt returns a variant key at given index within the all possible |
| 345 | // key combinations for v, or nil if index is out of range. |
| 346 | func (v Variants) possibleKeyAt(index int) []string { |
| 347 | keys := make([]string, len(v)) |
| 348 | for i := len(v) - 1; i >= 0; i-- { |
| 349 | vals := v[i][1:] // Drop header-name |
| 350 | keys[i] = vals[index%len(vals)] |
| 351 | index /= len(vals) |
| 352 | } |
| 353 | if index != 0 { |
| 354 | return nil // index out of range |
| 355 | } |
| 356 | return keys |
| 357 | } |
| 358 | |
| 359 | func (is *indexSection) Name() string { |
| 360 | return "index" |
no outgoing calls