gen

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCmd = &cobra.Command{
	Use:   "all",
	Short: "Run all generators",
	RunE: func(cmd *cobra.Command, args []string) error {
		fmt.Println("→ generating server...")
		if err := ServerCmd.RunE(cmd, args); err != nil {
			return err
		}

		fmt.Println("→ generating openapi...")
		if err := OpenAPICmd.RunE(cmd, args); err != nil {
			return err
		}

		fmt.Println("→ generating ent...")
		if err := EntCmd.RunE(cmd, args); err != nil {
			return err
		}

		fmt.Println("✔ all generators completed")
		return nil
	},
}
View Source
var EntCmd = &cobra.Command{
	Use:   "ent",
	Short: "Run go generate for ent schemas",
	Args:  cobra.MaximumNArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		dir := "ent"

		c := exec.Command("go", "generate", "./"+dir+"/...")
		c.Stdout = os.Stdout
		c.Stderr = os.Stderr
		c.Stdin = os.Stdin

		return c.Run()
	},
}
View Source
var OpenAPICmd = &cobra.Command{
	Use:   "openapi",
	Short: "Generate openapi.yaml",
	RunE: func(cmd *cobra.Command, args []string) error {
		return openapi.Generate(openapi.Config{
			Title:   "API",
			Version: "1.0.0",
			OutFile: "openapi.yaml",
		})
	},
}
View Source
var ServerCmd = &cobra.Command{
	Use:   "server",
	Short: "Generate HTTP server adapters for all modules",
	RunE: func(cmd *cobra.Command, args []string) error {
		return server.GenerateAll()
	},
}

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