Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Charset types CharsetNumbers = "0123456789" CharsetAlphabetic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" CharsetAlphanumeric = CharsetNumbers + CharsetAlphabetic )
Variables ¶
View Source
var ( ErrNotFeasible = errors.New("Not feasible to generate requested number of codes") ErrPatternIsNotMatch = errors.New("Pattern is not match with the length value") )
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct { // Length of the code to generate Length uint16 `json:"length"` // Count of the codes // How many codes to generate Count uint16 `json:"count"` // Charset to use // `CharsetNumbers`, `CharsetAlphabetic`, and `CharsetAlphanumeric` // are already defined and you can use them. Charset string `json:"charset"` // Prefix of the code Prefix string `json:"prefix"` // Suffix of the code Suffix string `json:"suffix"` // Pattern of the code // # is the placeholder for the charset Pattern string `json:"pattern"` }
func NewWithOptions ¶
Creates a new generator with options
Click to show internal directories.
Click to hide internal directories.