ugen

package module
v0.0.0-...-4c4c0f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

README

Usage

As a command

$ go install go.katupy.org/ugen/cmd/ugen@latest
$ ~/go/bin/ugen
D5XlMsS2e5Xb
$ ~/go/bin/ugen -h
Usage:
  ugen [flags]

Flags:
  -a, --any                Use any character from the random generator.
      --base64             Output base64 encoded strings. Sets --any.
  -c, --count int          The number of unique strings to generate. (default 1)
  -d, --digit              Use only digits. If length > 1, digit will never start with 0.
  -h, --help               help for ugen
      --hex                Output hex encoded strings. Sets --any.
  -i, --interval string    Generate a random number within the provided open ended, i.e., [_,_), interval. E.g., -1000,1000. If a single number is provided, the interval begins with zero. Ignores --length.
  -l, --length int         Length of the generated string. (default 12)
      --lower              Output characters in lower case.
      --prefix string      Write prefix before each generated string.
  -s, --separator string   Separator for generated strings. (default "\n")
      --suffix string      Write suffix after each generated string.
      --ulid               Generate a ULID.
      --ulid-as-uuid       Generate a ULID displayed as a UUID. Sets --ulid.
      --upper              Output characters in upper case.
      --uuid               Generate a random (v4) UUID.
      --uuid7              Generate a v7 UUID.

As a module

go get -u go.katupy.org/ugen

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	AnyCharacter bool
	Digit        bool
	Interval     string
	Base64       bool
	Hex          bool
	Ulid         bool
	UlidAsUuid   bool
	Uuid         bool
	Uuid7        bool
	Lower        bool
	Upper        bool
	Prefix       string
	Suffix       string
	Separator    string
	WithLineFeed bool
}

func (*Generator) Gen

func (g *Generator) Gen(writer io.Writer, count, length int) error

func (*Generator) GenInterval

func (g *Generator) GenInterval(writer io.Writer, count int) error

GenInterval works in a fundamentally different way than Gen since the string length can be variable, so we can't reuse the same (fixed-length) buffer for the results and possible encoding (base64, hex).

Directories

Path Synopsis
cmd
ugen command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL