config

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevOpsHelm      = "helm"
	DevOpsTerraform = "terraform"
	DevOpsAnsible   = "ansible"
)

DevOps tool choices

Variables

This section is empty.

Functions

func AddRecentProject

func AddRecentProject(projectPath string) error

AddRecentProject adds a project to recent projects list

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the configuration directory

func GetConfigSummary

func GetConfigSummary() map[string]interface{}

GetConfigSummary returns a summary of current configuration

func GetDevOpsToolDescription

func GetDevOpsToolDescription(tool string) string

GetDevOpsToolDescription returns description for DevOps tools

func GetProjectConfigDefaults

func GetProjectConfigDefaults() map[string]interface{}

GetProjectConfigDefaults returns default values for project configuration

func GetRecentProjects

func GetRecentProjects() []string

GetRecentProjects returns list of recently created projects

func GetValidDevOpsTools

func GetValidDevOpsTools() []string

GetValidDevOpsTools returns list of valid DevOps tools

func InitDefaults

func InitDefaults()

InitDefaults initializes default configuration values in viper

func IsCompatible

func IsCompatible(framework FrameworkChoice, database DatabaseChoice, tool ToolChoice) bool

IsCompatible checks if choices are compatible with each other

func IsValidArchitecture

func IsValidArchitecture(architecture ArchitectureChoice) bool

IsValidArchitecture checks if architecture choice is valid

func IsValidDatabase

func IsValidDatabase(database DatabaseChoice) bool

IsValidDatabase checks if database choice is valid

func IsValidDevOpsTool

func IsValidDevOpsTool(tool string) bool

IsValidDevOpsTool checks if DevOps tool is valid

func IsValidFramework

func IsValidFramework(framework FrameworkChoice) bool

IsValidFramework checks if framework choice is valid

func IsValidTool

func IsValidTool(tool ToolChoice) bool

IsValidTool checks if Tool choice is valid

func ResetConfig

func ResetConfig() error

ResetConfig resets configuration to defaults

func SaveConfig

func SaveConfig() error

SaveConfig saves the current configuration to file

func SaveProjectConfig

func SaveProjectConfig(cfg *ProjectConfig, filepath string) error

SaveProjectConfig saves project configuration to file

func UpdateConfig

func UpdateConfig(key string, value interface{}) error

UpdateConfig updates application configuration

func ValidateProjectConfig

func ValidateProjectConfig(config *ProjectConfig) []string

ValidateProjectConfig validates the project configuration using struct tags

Types

type AppConfig

type AppConfig struct {
	DefaultOutputDir    string `json:"default_output_dir" yaml:"default_output_dir"`
	DefaultModulePrefix string `json:"default_module_prefix" yaml:"default_module_prefix"`
	DefaultAuthor       string `json:"default_author" yaml:"default_author"`
	AnimationSpeed      int    `json:"animation_speed" yaml:"animation_speed"`
	ShowSplashScreen    bool   `json:"show_splash_screen" yaml:"show_splash_screen"`
	AutoSave            bool   `json:"auto_save" yaml:"auto_save"`
	Theme               string `json:"theme" yaml:"theme"`
}

AppConfig represents application-level configuration

func GetConfig

func GetConfig() *AppConfig

GetConfig returns the current application configuration

type ArchitectureChoice

type ArchitectureChoice string

Choice types for project configuration

const (
	ArchitectureSimple    ArchitectureChoice = "simple"
	ArchitectureDDD       ArchitectureChoice = "ddd"
	ArchitectureClean     ArchitectureChoice = "clean"
	ArchitectureHexagonal ArchitectureChoice = "hexagonal"
)

Architecture choices

func GetRecommendedArchitecture

func GetRecommendedArchitecture(complexity string) ArchitectureChoice

GetRecommendedArchitecture returns recommended architecture for project complexity

func GetValidArchitectures

func GetValidArchitectures() []ArchitectureChoice

GetValidArchitectures returns list of valid architecture choices

func (ArchitectureChoice) Description

func (a ArchitectureChoice) Description() string

func (ArchitectureChoice) String

func (a ArchitectureChoice) String() string

type DatabaseChoice

type DatabaseChoice string

Choice types for project configuration

const (
	DatabasepostgresQL DatabaseChoice = "postgresql"
	DatabaseMySQL      DatabaseChoice = "mysql"
	DatabaseSQLite     DatabaseChoice = "sqlite"
)

Database choices

func GetValidDatabases

func GetValidDatabases() []DatabaseChoice

GetValidDatabases returns list of valid database choices

func (DatabaseChoice) Description

func (d DatabaseChoice) Description() string

func (DatabaseChoice) RequiresServer

func (d DatabaseChoice) RequiresServer() bool

RequiresServer checks if database requires external server

func (DatabaseChoice) String

func (d DatabaseChoice) String() string

func (DatabaseChoice) SupportsRelations

func (d DatabaseChoice) SupportsRelations() bool

SupportsRelations checks if database supports relations

type DevOpsConfig

type DevOpsConfig struct {
	Enabled    bool     `json:"enabled"`
	Tools      []string `json:"tools"`
	Kubernetes bool     `json:"kubernetes"`
	Helm       bool     `json:"helm"`
	Terraform  bool     `json:"terraform"`
	Ansible    bool     `json:"ansible"`
}

DevOpsConfig holds the DevOps tool configuration

type FrameworkChoice

type FrameworkChoice string

Choice types for project configuration

const (
	FrameworkFiber FrameworkChoice = "fiber"
	FrameworkGin   FrameworkChoice = "gin"
	FrameworkChi   FrameworkChoice = "chi"
	FrameworkEcho  FrameworkChoice = "echo"
)

Framework choices

func GetValidFrameworks

func GetValidFrameworks() []FrameworkChoice

GetValidFrameworks returns list of valid framework choices

func (FrameworkChoice) Description

func (f FrameworkChoice) Description() string

func (FrameworkChoice) String

func (f FrameworkChoice) String() string

type ProjectConfig

type ProjectConfig struct {
	ProjectName  string             `json:"project_name" validate:"required,min=1"`
	ModulePath   string             `json:"module_path" validate:"required,modulepath"`
	Description  string             `json:"description"`
	OutputDir    string             `json:"output_dir" validate:"required"`
	Framework    FrameworkChoice    `json:"framework" validate:"required"`
	Database     DatabaseChoice     `json:"database" validate:"required"`
	Tool         ToolChoice         `json:"tool" validate:"required"`
	Architecture ArchitectureChoice `json:"architecture" validate:"required"`
	DevOps       DevOpsConfig       `json:"devops"`
	CreatedAt    time.Time          `json:"created_at"`
	UpdatedAt    time.Time          `json:"updated_at"`
}

ProjectConfig holds all the configuration for the project to be generated

func LoadProjectConfig

func LoadProjectConfig(filepath string) (*ProjectConfig, error)

LoadProjectConfig loads project configuration from file

func NewProjectConfig

func NewProjectConfig() *ProjectConfig

NewProjectConfig creates a new project configuration with defaults

type ToolChoice

type ToolChoice string

Choice types for project configuration

const (
	ToolSqlx ToolChoice = "sqlx"
	ToolSqlc ToolChoice = "sqlc"
	ToolGorm ToolChoice = "gorm"
)

Tool choices

func GetRecommendedTool

func GetRecommendedTool(database DatabaseChoice) ToolChoice

GetRecommendedTool returns recommended Tool for given database

func GetValidTools

func GetValidTools() []ToolChoice

GetValidTools returns list of valid Tool choices

func (ToolChoice) Description

func (t ToolChoice) Description() string

func (ToolChoice) HasCodeGeneration

func (t ToolChoice) HasCodeGeneration() bool

HasCodeGeneration checks if the Tool generates code

func (ToolChoice) HasMigrations

func (t ToolChoice) HasMigrations() bool

HasMigrations checks if the Tool supports migrations

func (ToolChoice) String

func (t ToolChoice) String() string

Jump to

Keyboard shortcuts

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