generate

package
v0.0.0-...-d981627 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Generate = &cobra.Command{
	Use:     "generate",
	Aliases: []string{"g"},
	Short:   "Generate various code, id, dummy data, etc",
	Long:    `generate various amount and/or type of code, id, dummy data, etc`,
	Args:    cobra.MinimumNArgs(1),
}
View Source
var GenerateJwt = &cobra.Command{
	Use:   "jwt",
	Short: "Generate JSON Web Token (JWT)",
	Long:  `generate various amount and/or validity of JSON web token (JWT)`,
	Run: func(cmd *cobra.Command, args []string) {
		expiredFlag, _ := cmd.Flags().GetBool("expired")

		for i := 0; i < int(Total); i++ {
			token, err := generateJwt(expiredFlag)
			if err != nil {
				log.Fatalln(err.Error())
				return
			}
			fmt.Println(token)
		}
	},
}
View Source
var GenerateUuid = &cobra.Command{
	Use:   "uuid",
	Short: "Generate universally unique identifier (UUID)",
	Long:  `generate various amount and/or version of universally unique identifier (UUID)`,
	Run: func(cmd *cobra.Command, args []string) {
		versionFlag, _ := cmd.Flags().GetString("version")

		for i := 0; i < int(Total); i++ {

			if versionFlag == "v1" {
				uuid := uuid.NewV1()
				fmt.Println(uuid)
			} else if versionFlag == "v4" {
				uuid := uuid.NewV4()
				fmt.Println(uuid)
			} else {
				log.Fatalf("UUID version '%v' is not valid/supported", versionFlag)
			}
		}
	},
}
View Source
var IsExpired bool
View Source
var Total uint
View Source
var Version string

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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