Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultAlphabet is the default alphabet for Nano ID. DefaultAlphabet = "-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // Only Alpha. Used as the first charactor of WebSafe IDs, // as numbers as not allowed as the first character of an HTML element ID AlphaOnly = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // No Punctuation, but all upper and lower alpha and all numeric characters AlphaNumeric = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // DefaultSize is the default size for Nano ID. DefaultSize = 21 )
Variables ¶
This section is empty.
Functions ¶
func FormatString ¶
func FormatString(generateRandomBuffer BytesGenerator, alphabet string, size int) (string, error)
FormatString generates a random string based on BytesGenerator, alphabet and size.
func GenerateString ¶
GenerateString generates a random string based on alphabet and size.
Types ¶
type BytesGenerator ¶
BytesGenerator represents random bytes buffer.
Click to show internal directories.
Click to hide internal directories.