Documentation
¶
Index ¶
- type RandomRegistry
- func (rr *RandomRegistry) LinkHandler(fh sprout.Handler) error
- func (rr *RandomRegistry) RandAlpha(size int) string
- func (rr *RandomRegistry) RandAlphaNumeric(size int) string
- func (rr *RandomRegistry) RandAscii(size int) string
- func (rr *RandomRegistry) RandBytes(size int) (string, error)
- func (rr *RandomRegistry) RandInt(min, max int) int
- func (rr *RandomRegistry) RandNumeric(size int) string
- func (rr *RandomRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
- func (rr *RandomRegistry) UID() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RandomRegistry ¶
type RandomRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *RandomRegistry
NewRegistry creates a new instance of regexp registry.
func (*RandomRegistry) LinkHandler ¶
func (rr *RandomRegistry) LinkHandler(fh sprout.Handler) error
LinkHandler links the handler to the registry at runtime.
func (*RandomRegistry) RandAlpha ¶
func (rr *RandomRegistry) RandAlpha(size int) string
RandAlpha generates a random alphabetic string of specified length.
Parameters:
size int - the length of the string to generate.
Returns:
string - the randomly generated alphabetic string.
For an example of this function in a Go template, refer to Sprout Documentation: randAlpha.
func (*RandomRegistry) RandAlphaNumeric ¶
func (rr *RandomRegistry) RandAlphaNumeric(size int) string
RandAlphaNumeric generates a random alphanumeric string of specified length.
Parameters:
size int - the length of the string to generate.
Returns:
string - the randomly generated alphanumeric string.
For an example of this function in a Go template, refer to Sprout Documentation: randAlphaNum.
func (*RandomRegistry) RandAscii ¶
func (rr *RandomRegistry) RandAscii(size int) string
RandAscii generates a random ASCII string (character codes 32 to 126) of specified length.
Parameters:
size int - the length of the string to generate.
Returns:
string - the randomly generated ASCII string.
For an example of this function in a Go template, refer to Sprout Documentation: randAscii.
func (*RandomRegistry) RandBytes ¶
func (rr *RandomRegistry) RandBytes(size int) (string, error)
RandBytes generates a random byte array of specified length and returns it as a base64 encoded string.
Parameters:
size int - the number of bytes to generate.
Returns:
string - the base64 encoded string of the randomly generated bytes.
For an example of this function in a Go template, refer to Sprout Documentation: randBytes.
func (*RandomRegistry) RandInt ¶
func (rr *RandomRegistry) RandInt(min, max int) int
RandInt generates a random integer between the specified minimum and maximum values (inclusive).
Parameters: - min: the minimum value of the range (inclusive). - max: the maximum value of the range (inclusive).
Returns: - int: the randomly generated integer.
For an example of this function in a Go template, refer to Sprout Documentation: randInt.
func (*RandomRegistry) RandNumeric ¶
func (rr *RandomRegistry) RandNumeric(size int) string
RandNumeric generates a random numeric string of specified length.
Parameters:
size int - the length of the string to generate.
Returns:
string - the randomly generated numeric string.
For an example of this function in a Go template, refer to Sprout Documentation: randNumeric.
func (*RandomRegistry) RegisterFunctions ¶
func (rr *RandomRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
RegisterFunctions registers all functions of the registry.
func (*RandomRegistry) UID ¶ added in v1.0.0
func (rr *RandomRegistry) UID() string
UID returns the unique identifier of the registry.