validation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirectoryExists

func EnsureDirectoryExists(dir string) error

EnsureDirectoryExists ensures a directory exists, creating it if necessary

func SuggestAvailablePort

func SuggestAvailablePort(startPort int) (int, error)

SuggestAvailablePort suggests an available port starting from the given port

func SuggestServiceName

func SuggestServiceName(name string) string

SuggestServiceName suggests a valid service name from an invalid one

func ValidateOutputDir

func ValidateOutputDir(dir string) error

ValidateOutputDir validates an output directory Creates it if it doesn't exist

func ValidatePath

func ValidatePath(path string) error

ValidatePath validates a file/directory path Checks if path is absolute and writable

func ValidatePort

func ValidatePort(port int) error

ValidatePort validates a port number Must be between 1024-65535 and not currently in use

func ValidateServiceName

func ValidateServiceName(name string) error

ValidateServiceName validates service name against go-zero requirements Service names must be valid Go identifiers: start with letter, no hyphens

Types

type ConfigError

type ConfigError struct {
	Field   string
	Message string
	Value   interface{}
}

ConfigError represents a configuration error

type ConfigValidationResult

type ConfigValidationResult struct {
	Valid    bool
	Errors   []ConfigError
	Warnings []ConfigWarning
}

ConfigValidationResult contains validation results for a config file

func ValidateAPIConfig

func ValidateAPIConfig(config map[string]interface{}) *ConfigValidationResult

ValidateAPIConfig validates go-zero API service configuration

func ValidateRPCConfig

func ValidateRPCConfig(config map[string]interface{}) *ConfigValidationResult

ValidateRPCConfig validates go-zero RPC service configuration

type ConfigWarning

type ConfigWarning struct {
	Field      string
	Message    string
	Suggestion string
}

ConfigWarning represents a configuration warning

Jump to

Keyboard shortcuts

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