generator

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ProjectManifestName = "got-project.json"

ProjectManifestName records how a service was generated so later GOT versions, such as "got upgrade", can recognize and evolve it.

Variables

This section is empty.

Functions

func EncodeProjectManifest added in v1.1.0

func EncodeProjectManifest(manifest ProjectManifest) ([]byte, error)

func GenerateHexagonalCRUD added in v1.1.0

func GenerateHexagonalCRUD(projectPath string, database dbschema.Database) error

GenerateHexagonalCRUD writes one entity per table through every hexagonal layer and registers it in the port registries and the HTTP routes.

func IsHexagonal added in v1.1.0

func IsHexagonal(projectPath string) bool

IsHexagonal reports whether got-project.json declares the hexagonal layout.

func PlanHexagonalCRUD added in v1.1.0

func PlanHexagonalCRUD(projectPath string, database dbschema.Database) ([]string, error)

PlanHexagonalCRUD returns the files GenerateHexagonalCRUD would create and the registries it would edit, after running every check.

Types

type APIGenerator

type APIGenerator struct{}

func (APIGenerator) Generate

func (APIGenerator) Generate(projectPath, apiName string) error

func (APIGenerator) GenerateCRUD

func (APIGenerator) GenerateCRUD(projectPath string, database dbschema.Database) error

func (APIGenerator) PlanCRUD added in v1.1.0

func (APIGenerator) PlanCRUD(projectPath string, database dbschema.Database) ([]string, error)

PlanCRUD runs every validation and preflight check of GenerateCRUD without writing, and returns the project-relative files it would create plus the route registry it would edit.

type AuthGenerator

type AuthGenerator struct{ Runner CommandRunner }

func (AuthGenerator) Generate

func (g AuthGenerator) Generate(ctx context.Context, projectPath string, options AuthOptions) error

type AuthOptions

type AuthOptions struct{ JWT bool }

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, dir, name string, args ...string) error
}

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, dir, name string, args ...string) error

type MethodGenerator

type MethodGenerator struct{}

func (MethodGenerator) Generate

func (MethodGenerator) Generate(projectPath string, options MethodOptions) error

type MethodOptions

type MethodOptions struct {
	Folder     string
	Name       string
	HTTPMethod string
	Path       string
}

type MigrationGenerator added in v1.1.0

type MigrationGenerator struct{}

MigrationGenerator adds an empty, numbered migration to a hexagonal project.

func (MigrationGenerator) Generate added in v1.1.0

func (MigrationGenerator) Generate(projectPath, name string) (string, error)

Generate writes internal/migration/postgres/<next>_<name>.go and returns its project-relative path.

type ProjectGenerator

type ProjectGenerator struct {
	Runner CommandRunner
	Output io.Writer
	// Version is the GOT version recorded in the generated project manifest.
	Version string
}

func (ProjectGenerator) Generate

func (g ProjectGenerator) Generate(ctx context.Context, options ProjectOptions) (returnErr error)

type ProjectManifest added in v1.1.0

type ProjectManifest struct {
	GOTVersion   string `json:"gotVersion"`
	Module       string `json:"module"`
	Architecture string `json:"architecture"`
	Database     string `json:"database"`
}

func ReadProjectManifest added in v1.1.0

func ReadProjectManifest(projectPath string) (ProjectManifest, error)

type ProjectOptions

type ProjectOptions struct {
	Name         string
	Module       string
	Architecture string
	Database     string
	ParentPath   string
	DBHost       string
	DBPort       uint16
	DBName       string
	DBUser       string
	Schema       *dbschema.Database
}

type SwaggerGenerator

type SwaggerGenerator struct{}

func (SwaggerGenerator) Generate

func (SwaggerGenerator) Generate(projectPath string) (returnErr error)

type UploadGenerator

type UploadGenerator struct{}

func (UploadGenerator) Generate

func (UploadGenerator) Generate(projectPath string) error

type WorkspaceGenerator

type WorkspaceGenerator struct {
	Runner  CommandRunner
	Output  io.Writer
	Version string
}

func (WorkspaceGenerator) AddService

func (g WorkspaceGenerator) AddService(ctx context.Context, root, name string) error

func (WorkspaceGenerator) Generate

func (g WorkspaceGenerator) Generate(ctx context.Context, options WorkspaceOptions) (returnErr error)

type WorkspaceOptions

type WorkspaceOptions struct {
	Name, Module, Database, ParentPath string
	SharedModule, SharedVersion        string
	Services                           []string
}

Jump to

Keyboard shortcuts

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