Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand takes a node set pattern like 'node[1-2]', and a function with the signature func(s string). It will parse the pattern string and calculate the numerical ranges from the pattern. It will then create the Cartesian product for the pattern, for example: rack[1-2]node[3-4] -> rack1node3, rack1node4, rack2node3, rack2node4. Addition pattern syntax supported: Union ranges - node[1-2,5-9] Step ranges - node[1-4/2] The supplied iter function is called per Cartesian product.
func SplitOnComma ¶
SplitOnComma will split the input string on commas except for when within square brackets. Used for pre-processing input strings for Expand when such input has multiple node patterns seperated by comma like 'node[1-2],node[5-6]'
Types ¶
type MatchGroup ¶
type MatchGroup struct { Length int // Length of original string NonDigitPositions map[int]string // Key is position index with the non-digit component as a value DigitPadding map[int]int // Key is position index of digit elements, value is length of digit elements. DigitPositions map[int]map[int]struct{} // Using a map of maps to only include unique digits: map[<pos. index>]map[<unique value>]struct{} }