validator

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(rules []ValidationRule) error

ValidateConfig validates environment variables using rules

Types

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
	Value   string `json:"value,omitempty"`
	Tag     string `json:"tag,omitempty"`
}

FieldError represents a validation error for a specific field

func (FieldError) Error

func (fe FieldError) Error() string

Error implements the error interface

type ValidationErrors

type ValidationErrors []FieldError

ValidationErrors represents multiple validation errors

func ValidateStruct

func ValidateStruct(s interface{}) ValidationErrors

ValidateStruct validates a struct using reflection and tags

func (ValidationErrors) Error

func (ve ValidationErrors) Error() string

Error implements the error interface

func (ValidationErrors) HasErrors

func (ve ValidationErrors) HasErrors() bool

HasErrors checks if there are any validation errors

type ValidationRule

type ValidationRule struct {
	Variable string
	Default  string
	Rule     func(value string) bool
	Message  string
}

ValidationRule represents a validation rule for environment variables

Jump to

Keyboard shortcuts

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